public void Show() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd() && PartIsAsm()) { ShowForm(); } }
private void btnLogin_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show("Please Enter Username"); return; } else if (String.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show("Please Enter Password"); return; } bool notFound = true; UserCTRL userctrl = new UserCTRL(); LoginCTRL loginctrl = new LoginCTRL(); foreach (Login l in loginctrl.getAllLogins()) { if (l.UserName == txtUsername.Text) { if (l.Password == txtPassword.Text) { User user = userctrl.getUserByID(l.ID); UserSingleton.Instance(user); if (user.IsAdmin && SignInAsAdminBox.Checked) { MessageBox.Show("Login Successful"); notFound = false; this.Hide(); AdminPg.getInstance(); } else if (!user.IsAdmin && SignInAsAdminBox.Checked) { MessageBox.Show("User is Not an Admin"); notFound = false; this.Hide(); HomePage.getInstance(); } else { //MessageBox.Show(UserSingleton.GetUser().ToString()); MessageBox.Show("Login Successful"); notFound = false; this.Hide(); HomePage.getInstance(); } } } } if (notFound) { MessageBox.Show("Invalid Username or Password."); } }
public static void Show() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetCAMJurisd()) { List <ProgramModel> groups = new List <ProgramModel>(); if (PartIsAsm(out groups)) { ShowForm(groups); } } }
private void ShowForm() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetCAMJurisd()) { ExportEleCMMForm form = new ExportEleCMMForm(); IntPtr intPtr = NXOpenUI.FormUtilities.GetDefaultParentWindowHandle(); NXOpenUI.FormUtilities.ReparentForm(form); NXOpenUI.FormUtilities.SetApplicationIcon(form); Application.Run(form); form.Dispose(); } }
public void Show() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { if (PartIsAsm()) { bool anyPartsModified1; NXOpen.PartSaveStatus partSaveStatus1; Session.GetSession().Parts.SaveAll(out anyPartsModified1, out partSaveStatus1); ShowForm(); } } }
/// <summary> /// 创建特征 /// </summary> /// <param name="mold"></param> private void CreateBulder(MoldInfo mold, string directoryPath) { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { AbstractCreateAssmbile asm = new AsmCreateAssmbile(mold, user.CreatorUser, workPart); List <string> err = asm.CreatePart(directoryPath); err.AddRange(asm.LoadAssmbile()); if (err.Count != 0) { ClassItem.Print(err.ToArray()); } } }
public static void CreateUserOper() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetCAMJurisd()) { Part workPart = Session.GetSession().Parts.Work; CreateElectrodeCAMBuilder cam = new CreateElectrodeCAMBuilder(workPart, user.CreatorUser); cam.CreateOperationNameModel(ElectrodeTemplate.User); List <string> err = cam.CreateUserOperation(); if (err.Count > 0) { ClassItem.Print(err.ToArray()); } } }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { theDialog.Show(); } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }
private void buttOk_Click(object sender, EventArgs e) { UserSingleton user = UserSingleton.Instance(); List <string> err = new List <string>(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { List <ElectrodeModel> eleModels = asmColl.GetElectrodes(); for (int i = 0; i < listView.Items.Count; i++) { if (listView.Items[i].Checked) { string eleName = listView.Items[i].SubItems[2].Text.ToString(); List <ElectrodeModel> models = eleModels.FindAll(a => a.Info.AllInfo.Name.EleName.Equals(eleName, StringComparison.CurrentCultureIgnoreCase)); if (models.Count > 0) { try { ElectrodeDrawingModel dra = new ElectrodeDrawingModel(models, asm.PartTag, user.CreatorUser); ElectrodeDrawingBuilder builder = new ElectrodeDrawingBuilder(dra, asm); builder.CreateBulider(); } catch (NXException ex) { err.Add(eleName + "电极出图错误!" + ex.Message); } } } } PartUtils.SetPartDisplay(asm.PartTag); Session.GetSession().ApplicationSwitchImmediate("UG_APP_MODELING"); if (err.Count > 0) { ClassItem.Print(err.ToArray()); } } this.Close(); }
private bool PartIsAsm() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { Part workPart = Session.GetSession().Parts.Work; if (!ASMModel.IsAsm(workPart)) { asm = ASMCollection.GetAsmModel(workPart); if (asm == null) { ClassItem.MessageBox("无法通过工作部件找到ASM!", NXMessageBox.DialogType.Error); return(false); } // PartUtils.SetPartDisplay(asm.PartTag); } asm = new ASMModel(workPart); asmColl = new ASMCollection(asm); foreach (WorkModel wk in asmColl.GetWorks()) { bool isInter = AttributeUtils.GetAttrForBool(wk.PartTag, "Interference"); if (!isInter) { NXOpen.UI.GetUI().NXMessageBox.Show("提示", NXMessageBox.DialogType.Error, wk.AssembleName + "没有检查电极"); return(false); } } return(true); } else { return(false); } }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { Part disPart = theSession.Parts.Display; if (!ASMModel.IsAsm(disPart)) { ASMModel asm = ASMCollection.GetAsmModel(disPart); if (asm != null) { PartUtils.SetPartDisplay(asm.PartTag); asmColl = new ASMCollection(asm); } else { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工作部件无法找到ASM!"); return(0); } } else { asmColl = new ASMCollection(new ASMModel(disPart)); } theDialog.Show(); } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }
public CreateEleStandardSeatForm(ElectrodeCreateExpAndMatr expAndMatr) { this.expAndMatr = expAndMatr; workPart = Session.GetSession().Parts.Work; user = UserSingleton.Instance(); }