コード例 #1
0
        public UIMainPanel()
        {
            UIView uiView = UIView.GetAView();

            vehicleSelectorBtn = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            mVehicleInfoListObject            = new GameObject("RoadNamePanel");
            mVehicleInfoList                  = mVehicleInfoListObject.AddComponent <VehicleInfoList>();
            mVehicleInfoList.transform.parent = uiView.transform;
            mVehicleInfoList.Hide();

            vehicleSelectorBtn.text              = "Vehicle Selector";
            vehicleSelectorBtn.width             = 150;
            vehicleSelectorBtn.height            = 30;
            vehicleSelectorBtn.normalBgSprite    = "ButtonMenu";
            vehicleSelectorBtn.disabledBgSprite  = "ButtonMenuDisabled";
            vehicleSelectorBtn.hoveredBgSprite   = "ButtonMenuHovered";
            vehicleSelectorBtn.focusedBgSprite   = "ButtonMenuFocused";
            vehicleSelectorBtn.pressedBgSprite   = "ButtonMenuPressed";
            vehicleSelectorBtn.textColor         = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            vehicleSelectorBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            vehicleSelectorBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.pressedTextColor  = new Color32(30, 30, 44, 255);
            vehicleSelectorBtn.eventClick       += VehicleSelectorBtn_eventClick;
            vehicleSelectorBtn.relativePosition  = new Vector3(330f, 20f);

            spawnMeshBtn                   = (UIButton)uiView.AddUIComponent(typeof(UIButton));
            spawnMeshBtn.text              = "Spawn Vehicle";
            spawnMeshBtn.width             = 150;
            spawnMeshBtn.height            = 30;
            spawnMeshBtn.normalBgSprite    = "ButtonMenu";
            spawnMeshBtn.disabledBgSprite  = "ButtonMenuDisabled";
            spawnMeshBtn.hoveredBgSprite   = "ButtonMenuHovered";
            spawnMeshBtn.focusedBgSprite   = "ButtonMenuFocused";
            spawnMeshBtn.textColor         = new Color32(255, 255, 255, 255);
            spawnMeshBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            spawnMeshBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            spawnMeshBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            spawnMeshBtn.eventClick       += SpawnMeshBtn_eventClick;
            spawnMeshBtn.relativePosition  = new Vector3(330f, 60f);

            EventBusManager.Instance().Subscribe("closeVehiclePanel", mVehicleInfoList);
            EventBusManager.Instance().Subscribe("closeAll", mVehicleInfoList);
        }
コード例 #2
0
        public override void Update(ViewModelReturnData VMReturnData)
        {
            if (VMReturnData.NewCardVNames_Active)
            {
                View.Visibility = Visibility.Visible;
                #region Navigationbar Details
                VMReturnData.ViewTitle         = "New Card";
                VMReturnData.SubTitle          = "Vehicle Name details";
                VMReturnData.CurrentPageNumber = 3;
                VMReturnData.TotalPageNumber   = 4;
                VMReturnData.MenuButtonEnabled = Visibility.Collapsed;
                VMReturnData.HelpButtonEnabled = Visibility.Visible;
                //Only update this viewModel when this view is visible
                #endregion

                if (!OneTimeRead)
                {
                    VehicleInfoList    = new ObservableCollection <string>();
                    DisplayVehicleList = new ObservableCollection <string>();
                    OneTimeRead        = true;
                    VehicleName        = "";
                    index = 0;
                }

                if (Bypassed)
                {
                    DisplayVehicleList = new ObservableCollection <string> {
                        "All Vehicle Serials"
                    };
                    ByEnabled = BtnAddEnabled = false;
                    VMReturnData.VMCardDetails.VehicleNames = Enumerable.Repeat("", 15).ToArray();
                    VMReturnData.VMCardDetails.ByPassBits   = VMReturnData.VMCardDetails.ByPassBits | 0x04;
                    VMReturnData.NextButtonEnabled          = true;
                }
                else
                {
                    DisplayVehicleList = VehicleInfoList;
                    for (int i = 0; i < index; i++)
                    {
                        VMReturnData.VMCardDetails.VehicleNames[i] = VehicleInfoList[i];
                    }
                    if (VehicleInfoList.Count < 15 && VehicleName != "")
                    {
                        ByEnabled = BtnAddEnabled = true;
                    }
                    else
                    {
                        ByEnabled = BtnAddEnabled = false;
                    }
                    VMReturnData.NextButtonEnabled        = VehicleInfoList.Count() > 0 ? true : false;
                    VMReturnData.VMCardDetails.ByPassBits = (uint)(VMReturnData.VMCardDetails.ByPassBits & ~0b00000100);
                }


                if (AddbtnPressed)
                {
                    if (index < 15 && VehicleName != "")
                    {
                        VMReturnData.VMCardDetails.VehicleNames[index] = VehicleName;
                        VehicleInfoList.Add(VehicleName);
                        index++;
                    }
                    else
                    {
                        BtnAddEnabled = false;
                    }

                    for (int i = index; i < 15; i++)
                    {
                        VMReturnData.VMCardDetails.VehicleNames[index] = null;
                    }

                    VehicleName   = "";
                    AddbtnPressed = false;
                }

                if (RemovebtnPressed)
                {
                    RemovebtnPressed = false;
                    if (VehicleInfoList.Count() > 0)
                    {
                        BtnremoveEnabled = true;
                        index--;
                        VMReturnData.VMCardDetails.VehicleNames[index] = null;
                        VehicleInfoList.RemoveAt(VehicleInfoList.Count - 1);
                    }
                }

                if (VehicleInfoList.Count() > 0)
                {
                    BtnremoveEnabled = true;
                }
                else
                {
                    BtnremoveEnabled = false;
                }
            }
            else
            {
                //View is not visible, do not update
                //Stop any animations on this vieModel
                View.Visibility = Visibility.Collapsed;
                OneTimeRead     = false;
            }
        }
コード例 #3
0
        public override void Update(ViewModelReturnData VMReturnData)
        {
            if (VMReturnData.LicenceView_Active)
            {
                View.Visibility = Visibility.Visible;

                #region NavigationBar details
                //               VMReturnData.ViewTitle = "Licence Details";
                VMReturnData.ViewTitle         = VMReturnData.cardInfoRead.UIDtoString(VMReturnData.prevUID);
                VMReturnData.SubTitle          = "Licence Details";
                VMReturnData.CurrentPageNumber = 1;
                VMReturnData.TotalPageNumber   = 1;
                VMReturnData.MenuButtonEnabled = Visibility.Visible;
                VMReturnData.HelpButtonEnabled = Visibility.Hidden;
                VMReturnData.NextButtonEnabled = false;
                VMReturnData.BackButtonEnabled = false;
                #endregion

                #region menu buttons
                VMReturnData.MenuEditBtnEnabled  = Visibility.Visible;
                VMReturnData.MenuIssueBtnEnabled = Visibility.Collapsed;
                #endregion

                //Only update this viewModel when this view is visible

                #region populate view
                if (!CardRead_Done)
                {
                    CardRead_Done = true;
                    VehicleInfoList.Clear();
                    switch (VMReturnData.cardInfoRead.cardDetails.Options)
                    {
                    case 3:
                        foreach (byte item in VMReturnData.cardInfoRead.cardDetails.VehicleGroup)
                        {
                            AccessType = "Group";
                            if (item != 0 && item != 255)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass {
                                    VehicleInfo = TagTypesL.MernokAssetGroups[item - 1].GroupName, ImagePath = "/Resources/Images/53272.jpg"
                                });
                            }
                            if (item == 255 && VehicleInfoList.Count == 0)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass
                                {
                                    VehicleInfo = "All Vehicle Groups",
                                    ImagePath   = ("/Resources/Images/TagTypes/Fleet.jpg")
                                });
                            }
                        }
                        break;

                    case 1:
                        foreach (uint item in VMReturnData.cardInfoRead.cardDetails.VID)
                        {
                            if (item != 0 && item != UInt16.MaxValue)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass {
                                    VehicleInfo = item.ToString("X"), ImagePath = "/Resources/Images/53272.jpg"
                                });
                            }
                            if (item == UInt16.MaxValue && VehicleInfoList.Count == 0)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass
                                {
                                    VehicleInfo = "All Vehicle Serails",
                                    ImagePath   = ("/Resources/Images/TagTypes/Fleet.jpg")
                                });
                            }
                            AccessType = "Serial";
                        }
                        break;

                    case 2:
                        foreach (string item in VMReturnData.cardInfoRead.cardDetails.VehicleNames)
                        {
                            if (item != null && item != "                " && item != "")
                            {
                                VehicleInfoList.Add(new VehicleInfoClass {
                                    VehicleInfo = item, ImagePath = " / Resources/Images/53272.jpg"
                                });
                            }
                            if (item == "                " && VehicleInfoList.Count == 0)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass
                                {
                                    VehicleInfo = "All Vehicle Names",
                                    ImagePath   = ("/Resources/Images/TagTypes/Fleet.jpg")
                                });
                            }
                            AccessType = "Name";
                        }
                        break;

                    case 0:
                        foreach (uint item in VMReturnData.cardInfoRead.cardDetails.VehicleLicenceType)
                        {
                            if (item != 0 && item != 255)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass
                                {
                                    VehicleInfo = TagTypesL.MernokAssetType[(int)item - 1].TypeName,
                                    ImagePath   = ("/Resources/Images/TagTypes/" + TagTypesL.MernokAssetType[(int)item - 1].Type.ToString() + ".png")
                                });
                            }
                            if (item == 255 && VehicleInfoList.Count == 0)
                            {
                                VehicleInfoList.Add(new VehicleInfoClass
                                {
                                    VehicleInfo = "All Vehicle Types",
                                    ImagePath   = ("/Resources/Images/TagTypes/Fleet.jpg")
                                });
                            }

                            AccessType = "Type";
                        }
                        break;


                    default:
                        break;
                    }

                    OperatorName    = VMReturnData.cardInfoRead.cardDetails.OperatorName;
                    OperatorID      = VMReturnData.cardInfoRead.cardDetails.OperatorID;
                    OperatorSurname = VMReturnData.cardInfoRead.cardDetails.OperatorSurname;
                    ProductCode     = mernokProductFile.mernokProductList.Where(t => t.Product == VMReturnData.cardInfoRead.cardDetails.ProductCode).First().ProductName;
                    //ClientGroup = (VMReturnData.cardInfoRead.cardDetails.Client_Group).ToString().Replace("_", " ");
                    ClientGroup         = mernokClientFile.mernokClientList.Where(t => t.Group == VMReturnData.cardInfoRead.cardDetails.Client_Group).First().ClientGroupName;
                    AccessLevel         = ((AccessLevel_enum)VMReturnData.cardInfoRead.cardDetails.AccessLevel).ToString().Replace("_", " ");
                    ExpireDate          = VMReturnData.cardInfoRead.cardDetails.Expiry_Date.ToShortDateString();
                    WarningDate         = VMReturnData.cardInfoRead.cardDetails.Warning_Date.ToShortDateString();
                    TrainingDate        = VMReturnData.cardInfoRead.cardDetails.Training_Date.ToShortDateString();
                    TrainingWarningDate = VMReturnData.cardInfoRead.cardDetails.Training_Warn_Date.ToShortDateString();
                    TrainingExpiryDate  = VMReturnData.cardInfoRead.cardDetails.Training_Exp_Date.ToShortDateString();
                    MedicalDate         = VMReturnData.cardInfoRead.cardDetails.Medical_Date.ToShortDateString();
                    MedicalWarningDate  = VMReturnData.cardInfoRead.cardDetails.Medical_Warn_Date.ToShortDateString();
                    MedicalExpiryDate   = VMReturnData.cardInfoRead.cardDetails.Medical_Exp_Date.ToShortDateString();
                    DoverDate           = VMReturnData.cardInfoRead.cardDetails.Dover_Date.ToShortDateString();
                    DoverWarningDate    = VMReturnData.cardInfoRead.cardDetails.Dover_Warn_Date.ToShortDateString();
                    DoverExpiryDate     = VMReturnData.cardInfoRead.cardDetails.Dover_Exp_Date.ToShortDateString();
                    IssueDate           = VMReturnData.cardInfoRead.cardDetails.Issue_Date.ToShortDateString();
                    IssuerUID           = VMReturnData.cardInfoRead.UIDtoString(VMReturnData.cardInfoRead.cardDetails.IssuerUID);
                    EngineerName        = VMReturnData.cardInfoRead.cardDetails.EngineerName;
                    EngineerUID         = VMReturnData.cardInfoRead.UIDtoString(VMReturnData.cardInfoRead.cardDetails.EngineerUID);
                    HotFlag             = VMReturnData.cardInfoRead.cardDetails.Hotflaged_status;
                    if (HotFlag)
                    {
                        HotFlagDate = VMReturnData.cardInfoRead.cardDetails.HotFlagedDate.ToShortDateString();
                        HotFlagUID  = VMReturnData.cardInfoRead.cardDetails.HotFlagedVID.ToString();
                    }
                    else
                    {
                        HotFlagDate = "";
                        HotFlagUID  = "";
                    }

                    //ClientCode = ((ClientSite)VMReturnData.cardInfoRead.cardDetails.Client_Site + " " + VMReturnData.cardInfoRead.cardDetails.OperationalArea).Replace("_", " ");
                    ClientCode = mernokClientFile.mernokClientList.Where(t => t.Client == VMReturnData.cardInfoRead.cardDetails.Client_Site).First().ClientSiteName + " " + VMReturnData.cardInfoRead.cardDetails.OperationalArea;

                    if (VMReturnData.cardInfoRead.cardDetails.Expiry_Date < DateTime.Now)
                    {
                        ExpColour = Brushes.Red;
                    }
                    else
                    {
                        ExpColour = null;
                    }

                    if (VMReturnData.cardInfoRead.cardDetails.Warning_Date < DateTime.Now)
                    {
                        WarnColor = Brushes.OrangeRed;
                    }
                    else
                    {
                        WarnColor = null;
                    }
                }



                #endregion
            }
            else
            {
                //View is not visible, do not update
                //Stop any animations on this vieModel
                View.Visibility = Visibility.Collapsed;
                CardRead_Done   = false;
            }
        }