コード例 #1
0
        private void DisplayOvenOptions_Click(object sender, RoutedEventArgs e)
        {
            string ovenName = DisplayOven.Text;

            if (ovenName.Equals(""))
            {
                MessageBox.Show("No Oven Specified, Please Select the Appropriate Oven.");
            }
            else
            {
                if (DisplayOptionsWrap.Children.Count > 3)
                {
                    DisplayOvenOptionsMaterial.Kind = MaterialDesignThemes.Wpf.PackIconKind.UnfoldMoreVertical;
                    while (DisplayOptionsWrap.Children.Count > 3)
                    {
                        DisplayOptionsWrap.Children.RemoveAt(3);
                    }
                    InitBaseGrid baseGrid = elements[0] as InitBaseGrid;
                    baseGrid.filterGrid(null, -1);
                }
                else
                {
                    DisplayOvenOptionsMaterial.Kind = MaterialDesignThemes.Wpf.PackIconKind.UnfoldLessVertical;
                    WrapPanel addGrid = InitDisplayRecipes();
                    DisplayOptionsWrap.Children.Add(addGrid);
                }
            }
        }
コード例 #2
0
        private void DisplayRecipeChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DisplayOptionsWrap.Children.Count > 4)
            {
                DisplayOptionsWrap.Children.RemoveAt(4);
            }
            string    RecipeName = (sender as ComboBox).SelectedItem as string;
            WrapPanel addGrid    = InitDisplayProgression(RecipeName);

            DisplayOptionsWrap.Children.Add(addGrid);
            InitBaseGrid baseGrid = elements[0] as InitBaseGrid;

            baseGrid.filterGrid(RecipeName, -1);
        }
コード例 #3
0
 private void ScreenRefresh(object sender, ElapsedEventArgs e)
 {
     if (MainWindow.connect.State.Equals(System.Data.ConnectionState.Closed) && elements.Count > 0)
     {
         this.Dispatcher.Invoke(() =>
         {
             InitBaseGrid baseGrid = elements[0] as InitBaseGrid;
             string ovenName       = baseGrid.getOvenName();
             if (InitBaseGrid.columnCount != Server.getColumnSizeFromDB(ovenName) ||
                 InitBaseGrid.rowCount != Server.getRowSizeFromDB(ovenName))
             {
                 removeInstance(ovenName);
                 addInstance(ovenName);
             }
         });
     }
 }
コード例 #4
0
        private void DisplayProgressionChanged(object sender, SelectionChangedEventArgs e)
        {
            InitBaseGrid baseGrid             = elements[0] as InitBaseGrid;
            string       prevProgressionID    = (sender as ComboBox).Text;
            WrapPanel    placeHolderWrapPanel = DisplayOptionsWrap.Children[3] as WrapPanel;
            ComboBox     DisplayRecipe        = placeHolderWrapPanel.Children[1] as ComboBox;
            string       recipeName           = DisplayRecipe.SelectedItem as string;

            if (prevProgressionID != null)
            {
                baseGrid.filterGrid(recipeName, -1);
            }
            string progressionID = (sender as ComboBox).SelectedItem as string;

            if (!progressionID.Equals("All"))
            {
                baseGrid.filterGrid(recipeName, Int32.Parse(progressionID));
            }
        }
コード例 #5
0
        private void ChangeSizeClick(string inOvenName)
        {
            OvenSpecifics ovenSpec = new OvenSpecifics(inOvenName);

            ovenSpec.ShowDialog();
            if (ovenSpec.getSizeChange())
            {
                removeInstance(inOvenName);

                InitBaseGrid baseGridClass = new InitBaseGrid(inOvenName);
                int          baseHeight    = baseGridClass.getHeight();
                int          baseWidth     = baseGridClass.getWidth();
                if (baseWidth <= WraperContent.MaxWidth)
                {
                    WraperContent.MaxWidth = SystemParameters.PrimaryScreenWidth;
                }
                if (baseWidth > WraperContent.MaxWidth)
                {
                    WraperContent.MaxWidth = baseWidth + 50;
                }
                InitMainBorder mainBorderClass = new InitMainBorder(inOvenName, baseHeight, baseWidth);
                InitMainGrid   mainGridClass   = new InitMainGrid(inOvenName, baseHeight, baseWidth);
                mainGridClass.ChangeSizeClick += ChangeSizeClick;
                mainGridClass.DeleteClick     += DeleteClick;
                mainGridClass.HelpClick       += DisplayHelp;

                Border    mainBorder = mainBorderClass.getMainBorder();
                Grid      mainGrid   = mainGridClass.getMainGrid();
                Grid      baseGrid   = baseGridClass.getGrid();
                Thickness margin     = baseGrid.Margin;
                margin.Top      = 25;
                margin.Left     = 0;
                margin.Right    = 0;
                margin.Bottom   = 0;
                baseGrid.Margin = margin;

                mainGrid.Children.Add(baseGrid);
                mainBorder.Child = mainGrid;
                elements.Add(baseGridClass);
                WraperContent.Children.Add(mainBorder);
            }
        }
コード例 #6
0
        private void removeInstance(string inOvenName)
        {
            InitInstance.prevOvens.Remove(inOvenName);
            for (int i = 0; i < elements.Count; i++)
            {
                InitBaseGrid placeHolder = elements[i] as InitBaseGrid;
                if (placeHolder.getOvenName().Equals(inOvenName))
                {
                    placeHolder.forceTimerStop();
                    WraperContent.Children.RemoveAt(i);
                    elements.RemoveAt(i);
                }
            }
            myEventHandler handler = ActionTaken;

            if (handler != null)
            {
                ActionTaken(true);
            }
        }
コード例 #7
0
        private void addInstance(string ovenName)
        {
            InitBaseGrid baseGridClass = new InitBaseGrid(ovenName);
            int          baseHeight    = baseGridClass.getHeight();
            int          baseWidth     = baseGridClass.getWidth();

            if (baseWidth > WraperContent.MaxWidth)
            {
                WraperContent.MaxWidth = baseWidth + 50;
            }
            InitMainBorder mainBorderClass = new InitMainBorder(ovenName, baseHeight, baseWidth);
            InitMainGrid   mainGridClass   = new InitMainGrid(ovenName, baseHeight, baseWidth);

            mainGridClass.ChangeSizeClick += ChangeSizeClick;
            mainGridClass.DeleteClick     += DeleteClick;
            mainGridClass.HelpClick       += DisplayHelp;

            Border    mainBorder = mainBorderClass.getMainBorder();
            Grid      mainGrid   = mainGridClass.getMainGrid();
            Grid      baseGrid   = baseGridClass.getGrid();
            Thickness margin     = baseGrid.Margin;

            margin.Top      = 25;
            margin.Left     = 0;
            margin.Right    = 0;
            margin.Bottom   = 0;
            baseGrid.Margin = margin;
            elements.Add(baseGridClass);
            mainGrid.Children.Add(baseGrid);
            mainBorder.Child = mainGrid;
            WraperContent.Children.Add(mainBorder);

            myEventHandler handler = ActionTaken;

            if (handler != null)
            {
                ActionTaken(false);
            }
        }
コード例 #8
0
 public TimerList()
 {
     this.secTick = new TimeSpan(0, 0, 0, 1, 0);
     elements     = new ObservableCollection <TimerListElement>();
     InitializeComponent();
     TimerGrid.ItemsSource     = elements;
     InitBaseGrid.ActionTaken += ClickActionTaken;
     Watcher.ActionTaken      += ClickActionTaken;
     if (Watcher.elements.Count != 0)
     {
         this.baseGrid = Watcher.elements[0] as InitBaseGrid;
         this.cells    = this.baseGrid.getCells();
         this.Icolbl   = this.baseGrid.getMaskingGrid();
         if (cells != null)
         {
             UpdateDataList();
             bubbleSort();
             startTimer();
             TimerGrid.Items.Refresh();
         }
     }
 }
コード例 #9
0
 private void DisplayOvenChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((sender as ComboBox).SelectedIndex != -1)
     {
         string ovenName     = (sender as ComboBox).SelectedItem as string;
         string prevOvenName = DisplayOven.Text;
         if (elements.Count == 1)
         {
             removeInstance(prevOvenName);
         }
         addInstance(ovenName);
         if (DisplayOptionsWrap.Children.Count > 3)
         {
             DisplayOvenOptionsMaterial.Kind = MaterialDesignThemes.Wpf.PackIconKind.UnfoldMoreVertical;
             while (DisplayOptionsWrap.Children.Count > 3)
             {
                 DisplayOptionsWrap.Children.RemoveAt(3);
             }
             InitBaseGrid baseGrid = elements[0] as InitBaseGrid;
             baseGrid.filterGrid(null, -1);
         }
     }
 }
コード例 #10
0
 private void ClickActionTaken(bool fromMainRemove)
 {
     if (fromMainRemove)
     {
         this.elements         = new ObservableCollection <TimerListElement>();
         TimerGrid.ItemsSource = elements;
         TimerGrid.Items.Refresh();
     }
     else
     {
         this.elements         = new ObservableCollection <TimerListElement>();
         TimerGrid.ItemsSource = elements;
         this.baseGrid         = Watcher.elements[0] as InitBaseGrid;
         this.cells            = this.baseGrid.getCells();
         this.Icolbl           = this.baseGrid.getMaskingGrid();
         if (cells != null)
         {
             UpdateDataList();
             bubbleSort();
             startTimer();
             TimerGrid.Items.Refresh();
         }
     }
 }