// ReSharper disable once InconsistentNaming // ReSharper disable once ArrangeTypeMemberModifiers static void Main() { using (new Mutex(true, Application.ProductName, out var createNew)) { if (createNew) { BonusSkins.Register(); SkinManager.EnableFormSkins(); UserLookAndFeel.Default.SetSkinStyle("DevExpress Style"); // 设置皮肤样式 BonusSkins.Register(); SkinManager.EnableFormSkins(); var token = InkoSecurityContext.GetToken(); // 如果登录失败或者取消登录,直接退出 if (!token) { return; } Application.Run(new PostCardCenterMainForm()); } else { MessageBox.Show(@"应用程序已经在运行中..."); Thread.Sleep(1000); Environment.Exit(1); } } }
private void BarButtonItem5_ItemClick(object sender, ItemClickEventArgs e) { InkoSecurityContext.Logout(); Hide(); if (new UserLogin().ShowDialog(this) == DialogResult.OK) { InkoSecurityContext.GetToken(); Show(); barSubItem2.Caption = InkoSecurityContext.UserName; barSubItem2.RibbonStyle = RibbonItemStyles.SmallWithText; } else { Close(); } }
static void Main() { using (new Mutex(true, Application.ProductName, out var createNew)) { if (createNew) { BonusSkins.Register(); SkinManager.EnableFormSkins(); UserLookAndFeel.Default.SetSkinStyle("DevExpress Style"); // 设置皮肤样式 var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + ConfigurationManager.AppSettings["log4net"]; var fi = new System.IO.FileInfo(path); log4net.Config.XmlConfigurator.Configure(fi); /* Application.EnableVisualStyles(); * Application.SetCompatibleTextRenderingDefault(false);*/ BonusSkins.Register(); SkinManager.EnableFormSkins(); if (InkoSecurityContext.GetToken()) { Application.Run(new PostCardProcessForm()); } } else { MessageBox.Show(@"应用程序已经在运行中..."); Thread.Sleep(1000); Environment.Exit(1); } } }