public void filterGrid(string recipeName, int progressionID)
        {
            if (recipeName == null && progressionID == -1)
            {
                for (int i = 0; i < rowCount; i++)
                {
                    for (int j = 0; j < columnCount; j++)
                    {
                        Icolbl[i, j].Background        = Brushes.Transparent;
                        locationLabel[i, j].Foreground = Brushes.Black;
                    }
                }
            }
            else
            {
                for (int i = 0; i < rowCount; i++)
                {
                    for (int j = 0; j < columnCount; j++)
                    {
                        if (myCells[i, j] != null)
                        {
                            int    recipeKey      = myCells[i, j].getRecipeKey();
                            string tempRecipeName = Server.getRecipeName(recipeKey);
                            int[]  placeHolder    = myCells[i, j].getProgressionID();
                            int    index          = Conversions.getLastProgressionID(placeHolder);
                            int    temp           = placeHolder[index];
                            if (recipeName.Equals(tempRecipeName) && progressionID == -1)
                            {
                                Icolbl[i, j].Background        = Brushes.Transparent;
                                locationLabel[i, j].Foreground = Brushes.Black;
                            }
                            else if (recipeName.Equals(tempRecipeName) && progressionID == temp)
                            {
                                Icolbl[i, j].Background        = Brushes.Transparent;
                                locationLabel[i, j].Foreground = Brushes.Black;
                            }
                            else
                            {
                                Icolbl[i, j].Background        = Brushes.Black;
                                locationLabel[i, j].Foreground = Brushes.Gray;
                            }
                        }
                        else
                        {
                            Icolbl[i, j].Background        = Brushes.Black;
                            locationLabel[i, j].Foreground = Brushes.Gray;
                        }
                    }
                }
            }
            myEventHandler handler = ActionTaken;

            if (handler != null)
            {
                ActionTaken(false);
            }
        }
예제 #2
0
        /*Constructor*/
        public EventViewModel()
        {
            Eventsingelton = EventCatalogSingleton.Instance;

            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            /*RelayCommand og refrence til handler*/
            eventHandler = new myEventHandler(this);



            CreateEventCommand = new RelayCommand(eventHandler.CreateEvent, null);
            DeleteEventComand  = new RelayCommand(eventHandler.DeleteEvent, checkOmListenErEmpty);
            PersistencyService.HentDataFraDiskAsync();
        }
        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);
            }
        }
        private void Panel_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Border         panel = sender as Border;
            MouseEventArgs me    = e as MouseEventArgs;

            if (me.LeftButton == MouseButtonState.Pressed)
            {
                char UniqueChar = 'A';
                UniqueChar = (char)((int)UniqueChar + System.Windows.Controls.Grid.GetRow(panel));
                int UniqueInt = System.Windows.Controls.Grid.GetColumn(panel);
                if (myCells[Grid.GetRow(panel), Grid.GetColumn(panel)] != null)
                {
                    myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].Click(false);
                }
                else
                {
                    ContainerHelper myContainer = new ContainerHelper(UniqueChar, UniqueInt);
                    myContainer.ShowDialog();
                    if (myContainer.getIsSubmit())
                    {
                        Server.UpdateComments(ovenName, UniqueChar, UniqueInt, myContainer.getComments());
                        Server.UpdateContainerNums(ovenName, UniqueChar, UniqueInt, myContainer.getContainerNums());
                        int[]      ProgressionID = myContainer.getProgressionID();
                        int        RecipeKey     = myContainer.getRecipeKey();
                        TimeSpan[] Limits        = Conversions.DateTimeToTimeSpan(Server.getLimits(ProgressionID[0]));
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)]                  = new Cell(this.ovenName, Limits, ProgressionID, RecipeKey, panel, lbl[Grid.GetRow(panel), Grid.GetColumn(panel)], Icolbl[Grid.GetRow(panel), Grid.GetColumn(panel)]);
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].timerLevel1     += cellTimerLevel1;
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].timerLevel2     += cellTimerLevel2;
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].timerLevel3     += cellTimerLevel3;
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].timerLevelReset += cellTimerLevelReset;
                        myCells[Grid.GetRow(panel), Grid.GetColumn(panel)].Click(false);
                    }
                }
                myEventHandler handler = ActionTaken;
                if (handler != null)
                {
                    ActionTaken(false);
                }
            }
        }
        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);
            }
        }
        private void clearActionTaken(string inOvenName, Border inputBorder, Label inputLabel)
        {
            char row    = Conversions.intToChar(Grid.GetRow(inputBorder));
            int  column = Grid.GetColumn(inputBorder);

            Server.clearOvenComments(ovenName, row, column);
            myCells[Conversions.charToInt(row), column].stopCellTimer();
            myCells[Conversions.charToInt(row), column].clearDataBaseEntires();
            myCells[Conversions.charToInt(row), column] = null;
            inputBorder.Background = new SolidColorBrush(Color.FromArgb(100, 100, 100, 100));
            inputLabel.Content     = "";
            if (Icolbl[Conversions.charToInt(row), column].Children.Count == 3)
            {
                Icolbl[Conversions.charToInt(row), column].Children.RemoveAt(2);
            }

            myEventHandler handler = ActionTaken;

            if (handler != null)
            {
                ActionTaken(false);
            }
        }