aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
blob: 22c1a5c00af871bec3753c6ebf9542198a32ac87 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<UserControl x:Class="Tango.MachineStudio.UI.Views.AboutView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:pmrPrinting="clr-namespace:Tango.PMR.Printing;assembly=Tango.PMR"
             xmlns:operation="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration"
             xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL"
             xmlns:adapters="clr-namespace:Tango.Transport.Adapters;assembly=Tango.Transport"
             xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="700" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:AboutViewVM, IsDesignTimeCreatable=False}" DataContext="{Binding AboutViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}">

    <UserControl.Resources>
        <converters:VersionToShortVersionConverter x:Key="VersionToShortVersionConverter" />
        <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
        <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
    </UserControl.Resources>

    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>

            <Grid>
                <StackPanel Orientation="Horizontal" Margin="10">
                    <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image>
                    <TextBlock Text="About" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1" Margin="10 0 10 10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>

                <Grid Margin="0 10 0 0">
                    <DockPanel>
                        <TextBlock DockPanel.Dock="Top">
                            This dialog contains information about your current version of Machine Studio.
                        </TextBlock>



                        <controls:TableGrid RowHeight="27" DockPanel.Dock="Top">
                            <TextBlock FontWeight="SemiBold">Machine Studio:</TextBlock>
                            <TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.Version,Mode=OneWay}"></Run></TextBlock>
                            <TextBlock FontWeight="SemiBold">Core Libraries:</TextBlock>
                            <TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.CoreVersion,Mode=OneWay}"></Run></TextBlock>
                            <TextBlock FontWeight="SemiBold">Build Date:</TextBlock>
                            <TextBlock Text="{Binding ApplicationManager.BuildDate,Mode=OneWay}"></TextBlock>
                            <TextBlock FontWeight="SemiBold">Data Mode:</TextBlock>
                            <TextBlock Text="{Binding MachineStudioSettings.Environment,Mode=OneWay}"></TextBlock>
                            <TextBlock FontWeight="SemiBold">Environment:</TextBlock>
                            <TextBlock Text="{Binding MachineStudioSettings.DeploymentSlot,Mode=OneWay}"></TextBlock>
                            <TextBlock FontWeight="SemiBold">Machine Service:</TextBlock>
                            <TextBlock Text="{Binding MachineStudioSettings.MachineServiceAddress}"></TextBlock>
                            <TextBlock FontWeight="SemiBold">Data Source:</TextBlock>
                            <TextBlock><Run Text="{Binding DataSource.Address,Mode=OneWay}"></Run>
                                <Run>(</Run><Run Foreground="{StaticResource GrayBrush}" Text="{Binding DataSource.Catalog,Mode=OneWay}"></Run><Run>)</Run>
                            </TextBlock>
                            <TextBlock FontWeight="SemiBold">Caching Mode:</TextBlock>
                            <DockPanel>
                                <ComboBox Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type bl:ObservablesContextInMemoryCachingMode},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.CachingMode}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
                                <TextBlock Margin="20 0 0 0" Foreground="{StaticResource GrayBrush}" VerticalAlignment="Center">(Requires restart)</TextBlock>
                            </DockPanel>
                            <TextBlock FontWeight="SemiBold">Job Upload Strategy:</TextBlock>
                            <ComboBox HorizontalAlignment="Left" Width="150" ItemsSource="{Binding Source={x:Type pmrPrinting:JobUploadStrategy},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUploadStrategy}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>

                            <TextBlock FontWeight="SemiBold">Job Units Duplication Method:</TextBlock>
                            <ComboBox HorizontalAlignment="Left" Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type operation:JobUnitsMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUnitsMethod}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>

                            <TextBlock FontWeight="SemiBold">External Bridge TCP Write Mode:</TextBlock>
                            <ComboBox HorizontalAlignment="Left" Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type adapters:TcpTransportAdapterWriteMode},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.TcpTransportAdapterWriteMode}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>

                        </controls:TableGrid>

                        <DockPanel Margin="0 0 0 0">
                            <TextBlock DockPanel.Dock="Top" FontWeight="SemiBold">Change Log:</TextBlock>
                            <TextBox Margin="0 5 0 0" Style="{x:Null}" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" TextWrapping="Wrap" AcceptsReturn="True" Foreground="{StaticResource DimGrayBrush}" Text="{Binding ApplicationManager.ChangeLog,Mode=OneWay}">

                            </TextBox>
                        </DockPanel>
                    </DockPanel>
                </Grid>

                <Grid Grid.Row="1">
                    <Button HorizontalAlignment="Right" Width="140" Command="{Binding OKCommand}">CLOSE</Button>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
bjectCollection<AXmlObject>(); } #region Helpper methods ObservableCollection<AXmlElement> elements; /// <summary> Gets direcly nested elements (non-recursive) </summary> public ObservableCollection<AXmlElement> Elements { get { if (elements == null) { elements = new FilteredCollection<AXmlElement, AXmlObjectCollection<AXmlObject>>(this.Children); } return elements; } } internal AXmlObject FirstChild { get { return this.Children[0]; } } internal AXmlObject LastChild { get { return this.Children[this.Children.Count - 1]; } } #endregion /// <inheritdoc/> public override IEnumerable<AXmlObject> GetSelfAndAllChildren() { return (new AXmlObject[] { this }).Flatten( delegate(AXmlObject i) { AXmlContainer container = i as AXmlContainer; if (container != null) return container.Children; else return null; } ); } /// <summary> /// Gets a child fully containg the given offset. /// Goes recursively down the tree. /// Specail case if at the end of attribute or text /// </summary> public AXmlObject GetChildAtOffset(int offset) { foreach(AXmlObject child in this.Children) { if ((child is AXmlAttribute || child is AXmlText) && offset == child.EndOffset) return child; if (child.StartOffset < offset && offset < child.EndOffset) { AXmlContainer container = child as AXmlContainer; if (container != null) { return container.GetChildAtOffset(offset); } else { return child; } } } return this; // No childs at offset } // Only these four methods should be used to modify the collection /// <summary> To be used exlucively by the parser </summary> internal void AddChild(AXmlObject item) { // Childs can be only added to newly parsed items Assert(this.Parent == null, "I have to be new"); Assert(item.IsCached, "Added item must be in cache"); // Do not set parent pointer this.Children.InsertItemAt(this.Children.Count, item); } /// <summary> To be used exlucively by the parser </summary> internal void AddChildren(IEnumerable<AXmlObject> items) { // Childs can be only added to newly parsed items Assert(this.Parent == null, "I have to be new"); // Do not set parent pointer this.Children.InsertItemsAt(this.Children.Count, items.ToList()); } /// <summary> /// To be used exclusively by the children update algorithm. /// Insert child and keep links consistent. /// </summary> void InsertChild(int index, AXmlObject item) { AXmlParser.Log("Inserting {0} at index {1}", item, index); Assert(this.Document != null, "Can not insert to dangling object"); Assert(item.Parent != this, "Can not own item twice"); SetParentPointersInTree(item); this.Children.InsertItemAt(index, item); this.Document.OnObjectInserted(index, item); } /// <summary> Recursively fix all parent pointer in a tree </summary> /// <remarks> /// Cache constraint: /// If cached item has parent set, then the whole subtree must be consistent and document set /// </remarks> void SetParentPointersInTree(AXmlObject item) { // All items come from the parser cache if (item.Parent == null) { // Dangling object - either a new parser object or removed tree (still cached) item.Parent = this; item.Document = this.Document; AXmlContainer container = item as AXmlContainer; if (container != null) { foreach(AXmlObject child in container.Children) { container.SetParentPointersInTree(child); } } } else if (item.Parent == this) { // If node is attached and then deattached, it will have null parent pointer // but valid subtree - so its children will alredy have correct parent pointer // like in this case // item.DebugCheckConsistency(false); // Rest of the tree is consistent - do not recurse } else { // From cache & parent set => consitent subtree // item.DebugCheckConsistency(false); // The parent (or any futher parents) can not be part of parsed document // becuase otherwise this item would be included twice => safe to change parents // Maintain cache constraint by setting parents to null foreach(AXmlObject ancest in item.GetAncestors().ToList()) { ancest.Parent = null; } item.Parent = this; // Rest of the tree is consistent - do not recurse } } /// <summary> /// To be used exclusively by the children update algorithm. /// Remove child, set parent to null and notify the document /// </summary> void RemoveChild(int index) { AXmlObject removed = this.Children[index]; AXmlParser.Log("Removing {0} at index {1}", removed, index); // Stop tracking if the object can not be used again if (!removed.IsCached) this.Document.Parser.TrackedSegments.RemoveParsedObject(removed); // Null parent pointer Assert(removed.Parent == this, "Inconsistent child"); removed.Parent = null; this.Children.RemoveItemAt(index); this.Document.OnObjectRemoved(index, removed); } /// <summary> Verify that the subtree is consistent. Only in debug build. </summary> /// <remarks> Parent pointers might be null or pointing somewhere else in parse tree </remarks> internal override void DebugCheckConsistency(bool checkParentPointers) { base.DebugCheckConsistency(checkParentPointers); AXmlObject prevChild = null; int myStartOffset = this.StartOffset; int myEndOffset = this.EndOffset; foreach(AXmlObject child in this.Children) { Assert(child.Length != 0, "Empty child"); if (checkParentPointers) { Assert(child.Parent != null, "Null parent reference"); Assert(child.Parent == this, "Inccorect parent reference"); } if (this.Document != null) { Assert(child.Document != null, "Child has null document"); Assert(child.Document == this.Document, "Child is in different document"); } if (this.IsCached) Assert(child.IsCached, "Child not in cache"); Assert(myStartOffset <= child.StartOffset && child.EndOffset <= myEndOffset, "Child not within parent text range"); if (prevChild != null) Assert(prevChild.EndOffset <= child.StartOffset, "Overlaping childs"); child.DebugCheckConsistency(checkParentPointers); prevChild = child; } } /// <remarks> /// Note the the method is not called recuively. /// Only the helper methods are recursive. /// </remarks> internal void UpdateTreeFrom(AXmlContainer srcContainer) { this.StartOffset = srcContainer.StartOffset; // Force the update this.UpdateDataFrom(srcContainer); RemoveChildrenNotIn(srcContainer.Children); InsertAndUpdateChildrenFrom(srcContainer.Children); } void RemoveChildrenNotIn(IList<AXmlObject> srcList) { Dictionary<int, AXmlObject> srcChildren = srcList.ToDictionary(i => i.StartOffset); for(int i = 0; i < this.Children.Count;) { AXmlObject child = this.Children[i]; AXmlObject srcChild; if (srcChildren.TryGetValue(child.StartOffset, out srcChild) && child.CanUpdateDataFrom(srcChild)) { // Keep only one item with given offset (we might have several due to deletion) srcChildren.Remove(child.StartOffset); // If contaner that needs updating AXmlContainer childAsContainer = child as AXmlContainer; if (childAsContainer != null && child.LastUpdatedFrom != srcChild) childAsContainer.RemoveChildrenNotIn(((AXmlContainer)srcChild).Children); i++; } else { RemoveChild(i); } } } void InsertAndUpdateChildrenFrom(IList<AXmlObject> srcList) { for(int i = 0; i < srcList.Count; i++) { // End of our list? if (i == this.Children.Count) { InsertChild(i, srcList[i]); continue; } AXmlObject child = this.Children[i]; AXmlObject srcChild = srcList[i]; if (child.CanUpdateDataFrom(srcChild)) { // includes offset test // Does it need updating? if (child.LastUpdatedFrom != srcChild) { child.UpdateDataFrom(srcChild); AXmlContainer childAsContainer = child as AXmlContainer; if (childAsContainer != null) childAsContainer.InsertAndUpdateChildrenFrom(((AXmlContainer)srcChild).Children); } } else { InsertChild(i, srcChild); } } Assert(this.Children.Count == srcList.Count, "List lengths differ after update"); } } }