aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/GradientOffsetSlider.xaml
blob: 4108e1cb6ba3ba13b586c91da9ffe35855ddd968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Tango.MachineStudio.Common.Resources"
                    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">


    <Style x:Key="SliderRepeatButton" TargetType="RepeatButton">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Border  BorderThickness="1" BorderBrush="#8A8A8A" Background="#8A8A8A" Height="3"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderRepeatButton1" TargetType="RepeatButton">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Border SnapsToDevicePixels="True" Background="#7F7F7F"  BorderThickness="1" BorderBrush="#777777" Height="3"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderThumb" TargetType="Thumb">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="Margin" Value="-11 -20 0 0"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Canvas>
                    <materialDesign:PackIcon Kind="MapMarker" Foreground="DimGray" Width="24" Background="Transparent" Height="24" IsHitTestVisible="True" Margin="0 0 0 0" />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="Slider"  TargetType="Slider">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Track Grid.Row="1" x:Name="PART_Track"   >
                <Track.DecreaseRepeatButton>
                    <RepeatButton Style="{StaticResource SliderRepeatButton1}"  Command="Slider.DecreaseLarge" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource SliderThumb}"  />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Style="{StaticResource SliderRepeatButton}" Command="Slider.IncreaseLarge" />
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
    </ControlTemplate>

    <Style x:Key="GradientOffsetSlider" TargetType="Slider">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinHeight" Value="21" />
                <Setter Property="MinWidth" Value="104" />
                <Setter Property="Template" Value="{StaticResource Slider}" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>
XmlDocument>(); } public static void LoadKnownTypeDocs(KnownType knownType) { XmlDocument xmlDoc = null; if (_assemblies_docs_cache.ContainsKey(knownType.Type.Assembly)) { xmlDoc = _assemblies_docs_cache[knownType.Type.Assembly]; } if (xmlDoc == null) { String dllPath = knownType.Type.Assembly.Location; string docuPath = dllPath.Substring(0, dllPath.LastIndexOf(".")) + ".XML"; if (File.Exists(docuPath)) { xmlDoc = new XmlDocument(); xmlDoc.Load(docuPath); } else if (File.Exists(System.IO.Path.Combine(dotNetXmlFolder, System.IO.Path.GetFileName(docuPath)))) { xmlDoc = new XmlDocument(); xmlDoc.Load(System.IO.Path.Combine(dotNetXmlFolder, System.IO.Path.GetFileName(docuPath))); } if (xmlDoc != null) { _assemblies_docs_cache.Add(knownType.Type.Assembly, xmlDoc); } } if (xmlDoc == null) { xmlDoc = new XmlDocument(); } //Load Type Summary { string path = "T:" + knownType.Type.FullName; XmlNode xmlDocuOfType = xmlDoc.SelectSingleNode("//member[starts-with(@name, '" + path + "')]"); if (xmlDocuOfType != null) { XmlNode summaryNode = xmlDocuOfType.SelectSingleNode("summary"); knownType.Summary = summaryNode.InnerText; } } //Load Constructors... { string path = "M:" + knownType.Type.FullName + ".#ctor"; var docNodes = xmlDoc.SelectNodes("//member[starts-with(@name, '" + path + "')]").OfType<XmlNode>().ToList(); for (int i = 0; i < knownType.Constructors.Count; i++) { var constructor = knownType.Constructors[i]; XmlNode cDoc = null; if (i < docNodes.Count) { cDoc = docNodes[i]; } constructor.Summary = cDoc != null ? cDoc.SelectSingleNode("summary").InnerXml : $"Initializes a new instance of {knownType.FriendlyName}."; var parameters = constructor.Parameters.ToList(); var parametersNodes = cDoc != null ? cDoc.SelectNodes("param").OfType<XmlNode>().ToList() : new List<XmlNode>(); for (int j = 0; j < parameters.Count; j++) { var parameter = parameters[j]; XmlNode pNode = null; if (j < parametersNodes.Count) { pNode = parametersNodes[j]; } parameter.Description = pNode != null ? pNode.InnerText : null; } } } //Load Methods... { string path = "M:" + knownType.Type.FullName; var docNodes = xmlDoc.SelectNodes("//member[starts-with(@name, '" + path + "')]").OfType<XmlNode>().ToList(); for (int i = 0; i < knownType.Methods.Count; i++) { var method = knownType.Methods[i]; XmlNode mDoc = null; mDoc = docNodes.FirstOrDefault(x => x.Attributes["name"].InnerText.Contains(knownType.Type.Name + "." + method.Name)); method.Summary = mDoc != null ? mDoc.SelectSingleNode("summary").InnerXml.Remove("(<see cref=\".:)|(\" \\/>)") : "No documentation"; var parameters = method.Parameters.ToList(); var parametersNodes = mDoc != null ? mDoc.SelectNodes("param").OfType<XmlNode>().ToList() : new List<XmlNode>(); bool isLinq = knownType.Type == typeof(Enumerable); for (int j = 0; j < parameters.Count; j++) { var parameter = parameters[j]; XmlNode pNode = null; if (j < parametersNodes.Count) { pNode = parametersNodes[j]; } parameter.Description = pNode != null ? pNode.InnerText.Remove("(<see cref=\".:)|(\" \\/>)") : null; } } } //Load Properties { string path = "P:" + knownType.Type.FullName; var docNodes = xmlDoc.SelectNodes("//member[starts-with(@name, '" + path + "')]").OfType<XmlNode>().ToList(); for (int i = 0; i < knownType.Properties.Count; i++) { var property = knownType.Properties[i]; var pDoc = docNodes.FirstOrDefault(x => x.Attributes["name"].InnerText.Contains(knownType.Type.Name + "." + property.Name)); property.Summary = pDoc != null ? pDoc.SelectSingleNode("summary").InnerXml : "No documentation"; } } //Load Enum Values { if (knownType.Type.IsEnum) { for (int i = 0; i < knownType.Fields.Count; i++) { var field = knownType.Fields[i]; var pDoc = xmlDoc.SelectSingleNode("//member[starts-with(@name, '" + $"F:{knownType.Type.FullName}.{field.Name}" + "')]"); field.Summary = pDoc != null ? pDoc.SelectSingleNode("summary").InnerXml : "No documentation"; } } } } } }