aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml
blob: 0b87025f5efd97e23826a297173e1048652fd98a (plain)
1
2
3
4
5
6
7
8
9
<Application x:Class="Tango.MachineStudio.Publisher.UI.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Tango.MachineStudio.Publisher.UI"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
         
    </Application.Resources>
</Application>
ight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.BL.Entities;
using Tango.Core.DI;
using Tango.PPC.Jobs.ViewContracts;
using Tango.PPC.Jobs.ViewModels;
using static Tango.SharedUI.Controls.NavigationControl;

namespace Tango.PPC.Jobs.Views
{
    /// <summary>
    /// Interaction logic for JobView.xaml
    /// </summary>
    public partial class JobView : UserControl, INavigationView, IJobView
    {
        private JobViewVM _vm;
        private bool _is_edit_docked;

        public JobView()
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                _vm = DataContext as JobViewVM;
            };

            TangoIOC.Default.Register<IJobView>(this);
        }

        public void OnNavigatedTo()
        {
            FloatEditing();
            scrollViewer.ScrollToTop();
        }

        private void OnBrushStopFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e)
        {
            _vm.OnBrushStopFieldValueChanged((sender as FrameworkElement).DataContext as BrushStop);
        }

        public async void DisplaySampleDye()
        {
            expander_sample_dye.IsExpanded = true;
            await Task.Delay(500);
            scrollViewer.ScrollToElement(expander_sample_dye);
        }

        public async void DisplayFineTuning()
        {
            expander_fine_tuning.IsExpanded = true;
            await Task.Delay(500);
            scrollViewer.ScrollToElement(expander_fine_tuning);
        }

        public void OnNavigatedFrom()
        {

        }

        private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e)
        {
            if (_vm.Job != null && _vm.Job.Segments != null && _vm.Job.Segments.Count > 3)
            {
                var position = scrollViewer.GetElementPosition(listSegments);
                var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput);

                if (stackOutputPosition.Y > 100)
                {
                    if (position.Y < 110 && !_is_edit_docked)
                    {
                        DockEditing();
                    }
                    else if (position.Y > 110 && _is_edit_docked)
                    {
                        FloatEditing();
                    }
                }
                else
                {
                    borderEditDock.Visibility = Visibility.Collapsed;
                }
            }
        }

        private void DockEditing()
        {
            _is_edit_docked = true;
            borderDockFloat.Child = null;
            borderEditDock.Child = dockEdit;
            borderEditDock.Visibility = Visibility.Visible;
        }

        private void FloatEditing()
        {
            _is_edit_docked = false;
            borderEditDock.Child = null;
            borderDockFloat.Child = dockEdit;
            borderEditDock.Visibility = Visibility.Collapsed;
        }
    }
}