aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MenuView.xaml
blob: b7f37b022082548cb4a875c4b1e6abfbc02ba39b (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
<UserControl x:Class="Tango.MachineStudio.Synchronization.Views.MenuView"
             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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.MachineStudio.Synchronization.Views"
             xmlns:global="clr-namespace:Tango.MachineStudio.Synchronization"
             mc:Ignorable="d" 
             d:DesignHeight="720" d:DesignWidth="1280" DataContext="{x:Static global:ViewModelLocator.MenuViewVM}">
    <Grid>
        <Grid>
            <Viewbox MaxWidth="1600">
                <UniformGrid Columns="3">
                    <Grid VerticalAlignment="Center">
                        <StackPanel>
                            <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30">
                                <TextBlock TextAlignment="Center" FontSize="25">Local Synchronization</TextBlock>
                                <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize two SQLite local database files.</TextBlock>
                            </StackPanel>
                            <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400">
                                <Grid Width="450">
                                    <StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Images/sqlite.png" Width="160"></Image>
                                            <Image Source="../Images/arrow_right.png" Width="100" RenderTransformOrigin="0.5,0.5"></Image>
                                            <Image Source="../Images/sqlite.png" Width="130"></Image>
                                        </StackPanel>

                                        <Button Command="{Binding StartLocalSyncCommand}" Height="80" Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button>
                                    </StackPanel>
                                </Grid>
                            </Viewbox>
                        </StackPanel>
                    </Grid>

                    <Grid VerticalAlignment="Center">
                        <StackPanel>
                            <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30">
                                <TextBlock TextAlignment="Center" FontSize="25">Direct Remote Synchronization</TextBlock>
                                <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Connect and synchronized a Tango machine over the network.</TextBlock>
                            </StackPanel>
                            <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400">
                                <Grid Width="450">
                                    <StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Images/remote-db.png" Width="200"></Image>
                                            <Image Source="../Images/arrow_right.png" Width="100"></Image>
                                            <Image Source="../Images/machine-trans.png" Width="120"></Image>
                                        </StackPanel>

                                        <Button Command="{Binding StartDirectRemoteSyncCommand}" Height="80"  Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button>
                                    </StackPanel>
                                </Grid>
                            </Viewbox>
                        </StackPanel>
                    </Grid>

                    <Grid VerticalAlignment="Center">
                        <StackPanel>
                            <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30">
                                <TextBlock TextAlignment="Center" FontSize="25">Semi Remote Synchronization</TextBlock>
                                <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize local SQLite database file with the remote Twine database.</TextBlock>
                            </StackPanel>
                            <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400">
                                <Grid Width="450">
                                    <StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="../Images/remote-db.png" Width="200"></Image>
                                            <Image Source="../Images/arrow_right.png" Width="100"></Image>
                                            <Image Source="../Images/sqlite.png" Width="120"></Image>
                                        </StackPanel>

                                        <Button Command="{Binding StartRemoteSyncCommand}" Height="80" Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button>
                                    </StackPanel>
                                </Grid>
                            </Viewbox>
                        </StackPanel>
                    </Grid>

                </UniformGrid>
            </Viewbox>
        </Grid>
    </Grid>
</UserControl>
s="w"> _isMenuOpened; } set { _isMenuOpened = value; RaisePropertyChangedAuto(); } } private bool _isNotificationsOpened; /// <summary> /// Gets or sets a value indicating whether to display all notifications. /// </summary> public bool IsNotificationsOpened { get { return _isNotificationsOpened; } set { _isNotificationsOpened = value; RaisePropertyChangedAuto(); } } /// <summary> /// Gets or sets the module navigation command. /// </summary> public RelayCommand<String> ModuleNavigationCommand { get; set; } /// <summary> /// Gets or sets the menu or back command. /// </summary> public RelayCommand MenuOrBackCommand { get; set; } /// <summary> /// Gets or sets the home command. /// </summary> public RelayCommand HomeCommand { get; set; } /// <summary> /// Gets or sets the notifications area pressed command. /// </summary> public RelayCommand NotificationsAreaPressedCommand { get; set; } /// <summary> /// Gets or sets the stop printing command. /// </summary> public RelayCommand StopPrintingCommand { get; set; } /// <summary> /// Gets or sets the sign-out command. /// </summary> public RelayCommand SignOutCommand { get; set; } /// <summary> /// Initializes a new instance of the <see cref="LayoutViewVM"/> class. /// </summary> public LayoutViewVM() { ModuleNavigationCommand = new RelayCommand<string>(NavigateToModule); HomeCommand = new RelayCommand(NavigateHome); MenuOrBackCommand = new RelayCommand(OpenMenuOrNavigateBack); NotificationsAreaPressedCommand = new RelayCommand(OpenFirstNotificationOrDisplayAll); StopPrintingCommand = new RelayCommand(StopPrinting); SignOutCommand = new RelayCommand(SignOut); } private void StopPrinting() { if (_jobHandler != null) { _jobHandler.Cancel(); } } /// <summary> /// Opens the menu or navigate back. /// </summary> private void OpenMenuOrNavigateBack() { if (NavigationManager.CanNavigateBack) { NavigationManager.NavigateBack(); } else { IsMenuOpened = true; } } /// <summary> /// Handles the module navigation command. /// </summary> /// <param name="moduleName">Name of the module.</param> private void NavigateToModule(string moduleName) { IsMenuOpened = false; NavigationManager.NavigateTo(moduleName); } /// <summary> /// Handles the home command. /// </summary> private void NavigateHome() { IsMenuOpened = false; NavigationManager.NavigateTo(NavigationView.HomeModule); } /// <summary> /// Called when the application has been started. /// </summary> public override void OnApplicationStarted() { base.OnApplicationStarted(); ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { _jobHandler = e.JobHandler; } /// <summary> /// Handles the ModulesLoaded event of the ModuleLoader. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ModuleLoader_ModulesLoaded(object sender, EventArgs e) { View.ApplyModules(ModuleLoader.UserModules); } /// <summary> /// Called when the instance of IPPCView is available. /// </summary> public override void OnViewAttached() { } /// <summary> /// Represents an event that is raised when the sign-out operation is complete. /// </summary> private void SignOut() { AuthenticationProvider.LogOut(); IsMenuOpened = false; } /// <summary> /// Opens the first notification or display all. /// </summary> private void OpenFirstNotificationOrDisplayAll() { if (NotificationProvider.NotificationItems.Count == 1) { //Open first } else { IsNotificationsOpened = true; } } } }