예제 #1
0
파일: MainForm.cs 프로젝트: Paztty/ICOP2
        public User.ICopPermision Login(bool isStart)
        {
            User.ICopPermision permision = User.ICopPermision.None;
            IcopLogin          icopLogin = new IcopLogin(isStart);

            icopLogin.ShowDialog();
            if (icopLogin.DialogResult == DialogResult.OK)
            {
                permision = icopLogin.permision;
                activeAcc = icopLogin.Acc;
                switch (permision)
                {
                case User.ICopPermision.None:
                    break;

                case User.ICopPermision.OP:
                    break;

                case User.ICopPermision.Technical:
                    TE_Acc = icopLogin.Acc;
                    break;

                case User.ICopPermision.Master:
                    MT_Acc = icopLogin.Acc;
                    break;

                default:
                    break;
                }
            }
            return(permision);
        }
예제 #2
0
파일: MainForm.cs 프로젝트: Paztty/ICOP2
        private void btModel_Click(object sender, EventArgs e)
        {
            User.ICopPermision permision = Login(false);

            if (permision == User.ICopPermision.Technical || permision == User.ICopPermision.Master)
            {
                ModelForm modelForm = new ModelForm(modelProgram.MotherFolder + modelProgram.ModelName + ".imdl", activeAcc);
                if (modelForm.ShowDialog() == DialogResult.OK)
                {
                    string modelJson = File.ReadAllText(modelForm.pathModel);
                    modelProgram     = JsonSerializer.Deserialize <ModelProgram>(modelJson);
                    lbModelName.Text = modelProgram.ModelName;
                    using (var fs = new System.IO.FileStream(modelProgram.ModelImagePathCam0, System.IO.FileMode.Open))
                    {
                        var bmp = new Bitmap(fs);
                        pbICam0.Image = (Bitmap)bmp.Clone();
                        modelProgram.ModelImageCam0 = (Bitmap)bmp.Clone();
                    }
                    using (var fs = new System.IO.FileStream(modelProgram.ModelImagePathCam1, System.IO.FileMode.Open))
                    {
                        var bmp = new Bitmap(fs);
                        pbICam1.Image = (Bitmap)bmp.Clone();
                        modelProgram.ModelImageCam1 = (Bitmap)bmp.Clone();
                    }
                    using (var fs = new System.IO.FileStream(modelProgram.ModelImagePathCam2, System.IO.FileMode.Open))
                    {
                        var bmp = new Bitmap(fs);
                        pbICam2.Image = (Bitmap)bmp.Clone();
                        modelProgram.ModelImageCam2 = (Bitmap)bmp.Clone();
                    }
                    using (var fs = new System.IO.FileStream(modelProgram.ModelImagePathCam3, System.IO.FileMode.Open))
                    {
                        var bmp = new Bitmap(fs);
                        pbICam3.Image = (Bitmap)bmp.Clone();
                        modelProgram.ModelImageCam3 = (Bitmap)bmp.Clone();
                    }

                    dgwProgram.Rows.Clear();
                    Global.addToLog("load step image of model " + modelProgram.ModelName);
                    for (int i = 0; i < modelProgram.modelSteps.Count; i++)
                    {
                        modelProgram.modelSteps[i].loadStepImage();
                        modelProgram.modelSteps[i].addToDataView(i, dgwProgram);
                    }
                    dgwProgram.Refresh();
                    lbModelName.Text           = modelProgram.ModelName;
                    tlpCamview.BackgroundImage = null;
                    modelProgram.loaded        = true;
                }
            }
        }
예제 #3
0
 private void btOK_Click(object sender, EventArgs e)
 {
     if (!isChangingPassword)
     {
         if (Acc.passWord == tbPassword.Text)
         {
             permision         = Acc.Permission;
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             lbNotification.Text = "Wrong password !";
         }
     }
     else
     {
         if (tbPasswordOld.Text == Acc.passWord)
         {
             if (tbPasswordNew.Text == tbRePassNew.Text)
             {
                 Acc.passWord = tbRePassNew.Text;
                 for (int i = 0; i < Global.users.accList.Count; i++)
                 {
                     if (Acc.userName == Global.users.accList[i].userName)
                     {
                         Global.users.accList[i] = Acc;
                         Global.users.update_change();
                     }
                 }
                 pnChangePassword.Hide();
                 isChangingPassword = false;
             }
             else
             {
                 lbNotification.Text = "New password not match !";
             }
         }
         else
         {
             lbNotification.Text = "Wrong password !";
         }
     }
 }