aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/function.png
blob: 92ccdbf4bbd9bada42aeca9ccbeb058b1f445958 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 40 00 00 00 40 08 03 00 00 00 9d b7 81 .PNG........IHDR...@...@........
0020 ec 00 00 00 03 73 42 49 54 08 08 08 db e1 4f e0 00 00 00 09 70 48 59 73 00 00 01 bb 00 00 01 bb .....sBIT.....O.....pHYs........
0040 01 3a ec e3 e2 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 77 77 77 2e 69 6e 6b 73 63 61 .:.......tEXtSoftware.www.inksca
0060 70 65 2e 6f 72 67 9b ee 3c 1a 00 00 02 85 50 4c 54 45 ff ff ff ff 00 00 ff 00 00 ff 80 00 ff 40 pe.org..<.....PLTE.............@
0080 40 ff 80 00 ff 66 33 ff 49 24 ff 55 1c e6 4d 33 ff 4d 33 ff 55 2b ff 4e 27 ff 55 22 ff 5a 2d f1 @....f3.I$.U..M3.M3.U+.N'.U".Z-.
00a0 47 1c ff 55 2b ff 51 28 f3 51 23 f4 59 2c f4 55 2b f5 52 29 f6 55 26 f6 52 24 f7 55 2b f7 52 29 G..U+.Q(.Q#.Y,.U+.R).U&.R$.U+.R)
00c0 f8 55 2b f8 53 29 eb 51 28 f9 57 25 f9 55 2b ee 51 29 f9 51 29 f9 53 27 fa 53 2a fa 55 28 ec 4d .U+.S).Q(.W%.U+.Q).Q).S'.S*.U(.M
00e0 26 fa 52 26 fa 53 2a fa 52 29 fb 55 26 fb 54 2a fb 52 29 f8 53 29 e9 49 28 f8 55 27 f8 54 26 f8 &.R&.S*.R).U&.T*.R).S).I(.U'.T&.
0100 53 29 f8 55 29 f8 53 28 f8 55 27 f9 54 27 f9 54 28 f0 4e 27 f9 54 27 f9 53 27 f9 54 29 f9 55 28 S).U).S(.U'.T'.T(.N'.T'.S'.T).U(
0120 f9 54 27 ee 4e 27 fa 55 29 fa 54 29 fa 53 28 fa 55 28 f0 4f 28 fa 54 28 fa 53 27 fa 54 29 f8 53 .T'.N'.U).T).S(.U(.O(.T(.S'.T).S
0140 29 f8 53 27 f8 54 29 f8 55 28 f8 54 28 f8 55 27 f9 54 29 f9 54 29 f9 55 28 f9 54 28 f9 54 27 f9 ).S'.T).U(.T(.U'.T).T).U(.T(.T'.
0160 54 28 ed 4e 28 f9 54 28 f9 53 28 f9 54 27 f9 54 29 f9 53 29 f9 54 28 f9 53 28 f9 54 27 eb 4c 29 T(.N(.T(.S(.T'.T).S).T(.S(.T'.L)
0180 f9 53 29 ed 4d 27 ef 4c 27 fa 53 29 fa 54 28 ee 4c 28 ef 4e 28 f8 54 27 ec 4d 27 f8 54 29 f8 54 .S).M'.L'.S).T(.L(.N(.T'.M'.T).T
01a0 28 f8 54 27 f8 53 27 f9 54 28 f9 53 28 f9 53 27 f9 54 29 f9 53 28 ed 4b 28 ed 4b 27 f9 54 29 f9 (.T'.S'.T(.S(.S'.T).S(.K(.K'.T).
01c0 54 29 f9 54 28 ed 4d 28 f9 54 28 f9 55 27 f9 54 28 f9 55 28 f9 54 28 f9 54 28 ed 4c 29 f9 54 29 T).T(.M(.T(.U'.T(.U(.T(.T(.L).T)
01e0 fa 54 28 fa 54 27 fa 54 28 fa 55 28 f8 55 28 f7 54 27 f8 55 28 f9 54 28 ec 4c 28 ec 4b 29 f9 54 .T(.T'.T(.U(.U(.T'.U(.T(.L(.K).T
0200 29 f9 55 28 eb 4b 29 f9 54 27 f9 55 28 f9 54 28 f9 54 28 ea 4a 28 f9 54 28 f9 54 28 f9 53 29 f9 ).U(.K).T'.U(.T(.T(.J(.T(.T(.S).
0220 54 28 f9 53 28 f6 52 28 f9 54 28 ea 4a 29 f9 53 27 f9 54 28 f9 54 28 f9 54 28 ea 4a 28 f9 54 28 T(.S(.R(.T(.J).S'.T(.T(.T(.J(.T(
0240 f9 54 28 e9 4a 29 ea 4a 28 f8 54 28 f8 54 28 ea 4b 28 f9 54 28 f9 54 28 ea 4a 28 f9 54 28 f9 54 .T(.J).J(.T(.T(.K(.T(.T(.J(.T(.T
0260 27 e9 49 28 ed 4b 28 f9 54 28 f9 54 28 e9 4a 28 e8 4a 28 f9 54 28 e7 49 28 e8 49 28 f3 4f 28 f9 '.I(.K(.T(.T(.J(.J(.T(.I(.I(.O(.
0280 54 28 e8 49 28 f0 4e 28 f9 54 28 f9 54 28 e8 48 28 f9 54 28 e8 49 28 f9 54 28 e7 48 28 f9 54 28 T(.I(.N(.T(.T(.H(.T(.I(.T(.H(.T(
02a0 f9 54 28 e6 47 28 e7 48 28 f9 54 28 e5 47 28 e6 47 28 e6 48 28 e7 48 28 e8 49 28 e9 4a 28 ea 4b .T(.G(.H(.T(.G(.G(.H(.H(.I(.J(.K
02c0 28 eb 4b 28 ec 4b 28 ec 4c 28 ed 4c 28 ed 4d 28 ee 4d 28 ef 4d 28 f0 4e 28 f1 4f 28 f2 50 28 f3 (.K(.K(.L(.L(.M(.M(.M(.N(.O(.P(.
02e0 50 28 f4 51 28 f5 51 28 f6 52 28 f7 53 28 f8 53 28 f8 54 28 f9 54 28 c6 83 27 1c 00 00 00 be 74 P(.Q(.Q(.R(.S(.S(.T(.T(..'.....t
0300 52 4e 53 00 01 02 02 04 04 05 07 09 0a 0a 0c 0d 0f 11 12 12 13 16 17 18 19 1b 1c 1e 1f 24 25 26 RNS..........................$%&
0320 29 2a 2c 2c 2e 31 33 35 35 37 38 3c 3d 3e 44 46 48 49 4a 4b 4d 4e 4f 52 55 55 56 58 5a 5b 5c 5d )*,,.135578<=>DFHIJKMNORUUVXZ[\]
0340 64 65 66 67 67 68 6a 6b 6e 70 72 74 75 76 77 78 7a 7c 7f 80 80 81 82 83 84 86 87 88 8a 8a 8f 90 defgghjknprtuvwxz|..........
using LiveCharts;
using LiveCharts.Wpf;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.SharedUI.Components;

namespace Tango.MachineStudio.Statistics.Views
{
    /// <summary>
    /// Interaction logic for JobRunsView.xaml
    /// </summary>
    public partial class JobRunsView : UserControl
    {
        private int _lastSelectedGridItemIndex;
        public JobRunsView()
        {
            InitializeComponent();
            _lastSelectedGridItemIndex = -1;
        }

        
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            selectMachineButton.IsChecked = true;
            e.Handled = true;
        }
        
        private void JobRunSourcesButton_Click(object sender, RoutedEventArgs e)
        {
            selectJobRunSources.IsChecked = true;
            e.Handled = true;
        }
        private void IsGradientButton_Click(object sender, RoutedEventArgs e)
        {
            selectIsGradient.IsChecked = true;
            e.Handled = true;
        }
        private void JobRunStatusButton_Click(object sender, RoutedEventArgs e)
        {
            selectJobRunStatus.IsChecked = true;
            e.Handled = true;
        }
        
        private async void TextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            await Task.Delay(200);
            TextBox txtBox = sender as TextBox;
            txtBox.SelectAll();
        }

        private void TextBox_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
        }

        private void SelectMachineButton_Click(object sender, RoutedEventArgs e)
        {
            selectThreadsButton.IsChecked = true;
            e.Handled = true;
        }

        private void IsHeadCleaningButton_Click(object sender, RoutedEventArgs e)
        {
            isHeadCleaningToggleButton.IsChecked = true;
            e.Handled = true;
        }

        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid dataGrid = sender as DataGrid;
            _lastSelectedGridItemIndex = -1;
            if (e.AddedItems != null && e.AddedItems.Count > 0)
            {
                DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0]);
                if (row != null)
                {
                    _lastSelectedGridItemIndex = row.GetIndex();
                }
            }
        }

        private void StartDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            DatePicker datePickerObj = sender as DatePicker;
            if(datePickerObj != null && datePickerObj.SelectedDate != null && endDatePicker.SelectedDate != null)
            {
                if(datePickerObj.SelectedDate> endDatePicker.SelectedDate)
                {
                    BindingExpression start_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty);
                    ValidationError validationError = new ValidationError(StartDateExpiredRule, start_be);
                    validationError.ErrorContent = "The start time must be less than or equal to end time.";
                    Validation.MarkInvalid(start_be, validationError);
                }
                else if (Validation.GetHasError(endDatePicker))
                {
                     BindingExpression end_be = endDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty);
                     Validation.ClearInvalid(end_be);
                }
            }
        }

        private void EndDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            DatePicker datePickerObj = sender as DatePicker;
            if (datePickerObj.SelectedDate != null && startdatePicker.SelectedDate != null )
            {
                if(datePickerObj != null && datePickerObj.SelectedDate < startdatePicker.SelectedDate)
                {
                    BindingExpression end_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty);
                    ValidationError validationError = new ValidationError(EndDateExpiredRule, end_be);
                    validationError.ErrorContent = "The end time must be greater than or equal to the start time.";
                    Validation.MarkInvalid(end_be, validationError);
                }
                else if (Validation.GetHasError(startdatePicker))
                {
                    BindingExpression start_be = startdatePicker.GetBindingExpression(DatePicker.SelectedDateProperty);
                    Validation.ClearInvalid(start_be);
                }
            }
        }

        private void CheckBox_PreventUndoCheck(object sender, RoutedEventArgs e)
        {
            if( sender is CheckBox)
            {
                CheckBox cb = sender as CheckBox;
                if (cb.IsChecked == false)
                {
                    cb.IsChecked = true;
                    e.Handled = true;
                    return;
                }
            }
            e.Handled = false;
        }
        private void CheckBox_StayChecked(object sender, RoutedEventArgs e)
        {
            if (sender is CheckBox)
            {
                CheckBox cb = sender as CheckBox;
                if (cb.IsChecked == false)
                {
                    var col = cb.Tag;
                    Type type = col.GetType();
                    if (col != null && col.GetType().GetGenericTypeDefinition() == typeof(SelectedObjectCollection<>))
                    {
                        dynamic dSynchedSource = type.GetProperty("SynchedSource").GetValue(col);
                        if(dSynchedSource != null && dSynchedSource.GetType().GetGenericTypeDefinition() == typeof(ObservableCollection<>) && dSynchedSource.Count == 0)
                        {
                                cb.IsChecked = true;
                                e.Handled = true;
                                return; 
                        }
                    }
                }
            }
            e.Handled = false;
        }
        
    }
}