Example #1
0
        //give user opportunity input\choose value\values
        //this method get next choosed value and set it to mrzs entity
        void changingValue(EmulatorDisplay d,Menu CurrMenu)
        {
            //get current entity
            mrzs05mMenu ent = AddFunctions.getEntityByID(LoadData.MrzsTable, CurrMenu.ID);

            //if value can be choosed by Enter
            if (ent.value == null)
            {
                string val = null;
                if (ent.kindSignalDCid != null)
                {
                    //get entity by another id that not equale id of Menu
                    kindSignalDC KindEnt = LoadData.kindSignalDCTable.Where(n => n.id != ent.kindSignalDCid).Single();
                    //get val from entity
                    val = KindEnt.kindSignal;

                    ent.kindSignalDCid = Convert.ToInt32(KindEnt.id);
                }
                else if (ent.typeSignalDCid != null)
                {
                    typeSignalDC TypeEnt = LoadData.typeSignalDCTable.Where(n => n.id != ent.typeSignalDCid).Single();
                    val = TypeEnt.typeSignal;
                    ent.typeSignalDCid = Convert.ToInt32(TypeEnt.id);
                }
                else if (ent.typeFuncDCid != null)
                {
                    typeFuncDC TypeFunc = LoadData.typeFuncDCTable.Where(n => n.@int != ent.typeFuncDCid).Single();
                    val = TypeFunc.typeFunction;
                    ent.typeFuncDCid = Convert.ToInt32(TypeFunc.@int);
                }
                else if (ent.BooleanVal2ID != null)
                {
                    BooleanVal2 Bool2Ent = LoadData.BooleanVal2Table.Where(n => n.id != ent.BooleanVal2ID).Single();
                    val = Bool2Ent.val;
                    //set new value to current mrzs05Menu entity
                    ent.BooleanVal2ID = Convert.ToInt32(Bool2Ent.id);
                }
                else if (ent.BooleanVal3ID != null)
                {
                    BooleanVal3 Bool3 = LoadData.BooleanVal3Table.Where(n => n.id != ent.BooleanVal3ID).Single();
                    val = Bool3.boolVal;
                    ent.BooleanVal3ID = Convert.ToInt32(Bool3.id);
                }
                else if (ent.mtzValID != null)
                {
                    mtzVal MtzEnt = LoadData.mtzValTable.Where(n => n.id != ent.mtzValID).Single();
                    val = MtzEnt.mtzVals;
                    ent.mtzValID = Convert.ToInt32(MtzEnt.id);
                }
                else if (ent.BooleanValID != null)
                {
                    BooleanVal bEnt = LoadData.BooleanValTable.Where(n => n.id != ent.BooleanValID).Single();
                    val = bEnt.val;
                    ent.BooleanValID = bEnt.id;
                }
                CurrMenu.SecondLine = val;
                dispControllr.SecondMenuStr = val;

            }
            //if changed\entered numerical value
            //else
            //{
            //    //changing\enter numerical value
            //    NumValue.parseNumeric(d.SecondTextBlock, d.SecondTextBlock.Text);
            //}
        }
Example #2
0
        internal void enterButtonClicked(EmulatorDisplay d)
        {
            //get choosed Menu
            Menu ChoosedMenu = dispControllr.getChoosedMenuClass();
            if (ChoosedMenu != null)
            {
                //get deeper Menu level by ID choosed menu
                List<Menu> list = getMenu(ChoosedMenu.ID);
                //no deeper menu
                if (list.Count == 0)
                {
                    //if showed that password entered incorrect
                    if (PasswordController.IsPasswordCorrect() == false)
                    {
                        PasswordController.setPasswordAsk();
                        //show parent menu
                        returnToParentMenu();
                        return;
                    }

                    PasswordController.passwordProcess();
                        //first show text with selected second line
                    if (PasswordController.canShowValueWithSelection())
                    {
                        //show menu
                        Menu m=dispControllr.getChoosedMenuClass();
                        dispControllr.showText(m.FirstLine, m.SecondLine);

                        //select first digit
                        if (Inputing.isNumericValue(m.SecondLine))
                        {
                            changingNumValue2(d, dispControllr.getChoosedMenuClass());
                        }
                        //select all value
                        else d.IsSecondLineSelected = true;

                    }
                        //show next value
                    else if (PasswordController.canShowChangebleValue())
                    {
                        Menu m = dispControllr.getChoosedMenuClass();
                        if (Inputing.isNumericValue(m.SecondLine))
                        {
                            //canseled\saving dialog
                            changingNumValue2(d, dispControllr.getChoosedMenuClass());
                            d.IsSecondLineSelected = false;
                            dispControllr.showText("Вы уверены?", "Enter-ДА, Esc-НЕТ");
                            //set waiting state of confirming value by user
                            PasswordController.setWaintingState();
                            return;
                        }
                        else
                        {
                            //select all value
                            changingValue(d, dispControllr.getChoosedMenuClass());
                            d.IsSecondLineSelected = true;
                        }
                    }
                        //if user want save inputed\choosed value
                    else if (PasswordController.isWaitingState())
                    {
                        LoadData.savingAllChanges();
                        //set first state
                        PasswordController.setPasswordAsk();
                        //show parent last selected menu
                        returnToParentMenu();
                    }
                }
                //still exist deeper menu
                else
                {
                    dispControllr.showMenu(list);
                    //add choosed Menu id to list
                    SelectedID.Add(ChoosedMenu.ID);
                }
            }
        }
Example #3
0
 //select inputed numeric value and temporary saving
 void changingNumValue2(EmulatorDisplay d, Menu CurrMenu)
 {
     //get current entity
     mrzs05mMenu ent = AddFunctions.getEntityByID(LoadData.MrzsTable, CurrMenu.ID);
     NumValue.parseNumeric(d.SecondTextBlock, d.SecondTextBlock.Text);
     //temporary saved value
     NumValue.setValue(dispControllr.SecondMenuStr);
     CurrMenu.SecondLine = NumValue.getValue() + CurrMenu.Unit;
     if (ent.value.Equals(NumValue.getValue()) == false) ent.value = NumValue.getValue();
 }
Example #4
0
 //impruve selection
 private static void impruveSelection(EmulatorDisplay d)
 {
     //check width of selection
     if (d.IsSecondLineSelected)
     {
         d.SecondBorder.Width = d.SecondTextBlock.Text.Length * 16;
     }
 }
Example #5
0
 internal void showPreviousMenuLine(EmulatorDisplay d)
 {
     dispControllr.moveToPreviousLine();
     impruveSelection(d);
 }
Example #6
0
 internal void showNextMenuLine(EmulatorDisplay d)
 {
     dispControllr.moveToNextLine();
     impruveSelection(d);
 }
Example #7
0
        internal void escButtonClicked(EmulatorDisplay d)
        {
            //if user canseled after entering\choosing value
            if (PasswordController.canShowChangebleValue()||PasswordController.canShowValueWithSelection())
            {
                Menu m = dispControllr.getChoosedMenuClass();
                if (Inputing.isNumericValue(m.SecondLine))
                {
                    //saving numeric value
                    changingNumValue2(d, m);
                }

                //turn off selection
                d.IsSecondLineSelected = false;
                dispControllr.showText("Вы уверены?", "Enter-ДА, Esc-НЕТ");
                //set waiting state of confirming value by user
                PasswordController.setWaintingState();
                return;
            }
            //if user want reject entered\choosed value
            else if (PasswordController.isWaitingState())
            {
                LoadData.rejectAllChanges();
                //set first state
                PasswordController.setPasswordAsk();
            }
            //if showed that password entered incorrect or canseled entering password process
            else if (PasswordController.IsPasswordCorrect() == false||PasswordController.IsCheckPassword())
            {
                PasswordController.setPasswordAsk();
            }

            //if no selected mrzs05menu entity
            if (SelectedID.Count == 0) return;

            returnToParentMenu();
        }