Esempio n. 1
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var gallery = new DevExpress.XtraBars.Ribbon.GalleryDropDown();

            gallery.Manager = barManager1;
            SkinHelper.InitSkinGalleryDropDown(gallery);
            gallery.ShowPopup(MousePosition);
        }
Esempio n. 2
0
        private void cargarLookAndFeel()
        {
            var gallery = new DevExpress.XtraBars.Ribbon.GalleryDropDown();

            gallery.Manager = barManager1;
            SkinHelper.InitSkinGalleryDropDown(gallery);
            gallery.ShowPopup(MousePosition);
        }
Esempio n. 3
0
 public MainUI()
 {
     BonusSkins.Register();
     SkinManager.EnableFormSkins();
     //UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");
     InitializeLocalCache();
     #region 用户尝试登录系统
     SharedFunc.TryLogin();
     sys_User = Provider.SysUser;
     sw.Restart();
     #endregion
     #region 加载系统主界面
     try
     {
         #region InitializeComponent
         Provider.StartupPath = ConfigurationHelper.ReadSetting("StartupPath");
         SplashScreenManager.ShowForm(this, typeof(MyWait), false, false, false);
         InitializeAppearance();
         SendSpalsh(10, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_GlobalLocalizer));
         //InitializeGlobalConfiguration();
         InitializeGlobalLocalizer();
         SendSpalsh(20, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Component));
         InitializeComponent();
         SkinHelper.InitSkinGalleryDropDown(mySkin);
         barUserNick.Caption = sys_User.User_Nick;
         SendSpalsh(50, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_CommonLocalizer));
         InitializeCommonLocalizer();
         SendSpalsh(60, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Image));
         InitializeImage();
         SendSpalsh(80, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Menu));
         InitializeMenu();
         SendSpalsh(90, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Configuration));
         InitializeConfiguration();
         SendSpalsh(95, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_AutoUpdate));
         //InitializeAutoUpdate();
         SendSpalsh(100, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Finish));
         //写日志
         SharedFunc.TipError(myCommonLocalizer.GetLocalizedString(MyCommonStringId.Login_Succeed), myCommonLocalizer.GetLocalizedString(MyCommonStringId.Login_SucceedDetail));
         //GC.Collect();
         #endregion
     }
     catch (Exception ex)
     {
         SharedFunc.RaiseError(ex);
         Process.GetCurrentProcess().Kill();
         //Application.Exit();
         //Environment.Exit(0);
     }
     #endregion
 }
Esempio n. 4
0
        private void MainView_Load(object sender, EventArgs e)
        {
            Common.GetMACs(out LocalMAC);
            Common.GetLocalIpv4(out LocalIP);
            //try { RemoteIP = Common.GetRemoteIP(); } catch { RemoteIP = string.Empty; }
            RemoteIP = string.Empty;
            //检查登录是否是被授权的

            if ((this.CurUser.IgnoreCaseEqual("admin")))
            {
                barBtnSysMnu.Visibility = BarItemVisibility.Always;
            }
            else
            {
                barBtnSysMnu.Visibility = BarItemVisibility.Never;
            }
            this.barLabel.Caption = this.CurUser;
            var skinGallery = new DevExpress.XtraBars.Ribbon.GalleryDropDown();

            skinGallery.Manager            = this.barManager1;
            this.barSkin.ButtonStyle       = BarButtonStyle.DropDown;
            this.barSkin.DropDownControl   = skinGallery;
            this.barSkin.ActAsDropDown     = true;
            skinGallery.Gallery.ItemClick += (obj, se) => {
                this.OptConfig.Set <string>("SkinName", se.Item.Caption);
                Lanucher.ReLoadSkinName();
            };
            SkinHelper.InitSkinGalleryDropDown(skinGallery);
            var mnustyle = OptConfig.Get <string>("Menu");

            if (mnustyle == "Taobao")
            {
                barChkTaobao.Checked = true;
            }
            else
            {
                barChkSys.Checked = true;
            }
            SqlConnectionStringBuilder bld = new SqlConnectionStringBuilder(ConnString);

            barStaticItem2.Caption  = string.Format("{0} {1}", bld.DataSource.ToString(), bld.InitialCatalog);
            barStaticItem2.Caption += " " + RemoteIP;

            //同步服务器时间
            var serverTime = (DateTime)SqlHelper.ExecuteScalar(ConnString, CommandType.Text, "select getdate()");

            TimeSync.Default.StartSync(serverTime);

            //var t = new Thread(() => {
            //    while (true) {
            //        Thread.Sleep(1000);
            //        if (this.IsDisposed)
            //            return;
            //        while (!this.IsHandleCreated) { }
            //        this.Invoke(new Action(() => {
            //            barStaticItem3.Caption = TimeSync.Default.CurrentSyncTime.ToString("yyyy-MM-dd HH:mm:ss");
            //        }));
            //    }
            //});
            //t.IsBackground = true;
            //t.Start();

            //加载菜单
            LoadMenu();
            if (string.Compare(OptConfig.Get <string>("Menu"), "taobao", true) == 0)
            {
                barChkTaobao.Checked = true;
                barChkSys.Checked    = false;
                foreach (NavBarGroup gp in navMenu.Groups)
                {
                    gp.Expanded = true;
                }
            }
            else
            {
                barChkSys.Checked = true; barChkTaobao.Checked = false;
            }
            var w = OptConfig.Get <int>("MenuWidth");

            if (w > 0)
            {
                this.navMenu.Width = w;
            }

            try {
                var mpv = Lanucher.Start("Ultra.MainPage.MainView");
                if (null != mpv)
                {
                    mpv.MdiParent = this;
                    mpv.Show();
                }
            } catch { }
            var threg = new Thread(() => { RegSelfLogin(); });

            threg.IsBackground = true;
            threg.Start();
        }
Esempio n. 5
0
        private void MainView_Load(object sender, EventArgs e)
        {
            Common.GetMACs(out LocalMAC);
            Common.GetLocalIpv4(out LocalIP);
            //try { RemoteIP = Common.GetRemoteIP(); } catch { RemoteIP = string.Empty; }
            RemoteIP = string.Empty;
            //检查登录是否是被授权的
            if (!IsAllowLogin())
            {
                SqlHelper.ExecuteNonQuery(ConnString, CommandType.Text, Sql_AddLoginFail,
                                          new SqlParameter("@LoginMAC", LocalMAC),
                                          new SqlParameter("@ExternalIP", RemoteIP),
                                          new SqlParameter("@LocalIP", LocalIP),
                                          new SqlParameter("@UserName", CurUser)
                                          );
                this.Invoke(new Action(() => {
                    this.navMenu.Enabled = false;
                    this.bar1.Visible    = false;
                    this.Text           += " 未被授权的登录";
                }));
                return;
            }
            if ((this.CurUser.IgnoreCaseEqual("admin")))
            {
                barBtnSysMnu.Visibility = BarItemVisibility.Always;
            }
            else
            {
                barBtnSysMnu.Visibility = BarItemVisibility.Never;
            }
            this.barLabel.Caption = this.CurUser;
            var skinGallery = new DevExpress.XtraBars.Ribbon.GalleryDropDown();

            skinGallery.Manager            = this.barManager1;
            this.barSkin.ButtonStyle       = BarButtonStyle.DropDown;
            this.barSkin.DropDownControl   = skinGallery;
            this.barSkin.ActAsDropDown     = true;
            skinGallery.Gallery.ItemClick += (obj, se) => {
                this.OptConfig.Set <string>("SkinName", se.Item.Caption);
                Lanucher.ReLoadSkinName();
            };
            SkinHelper.InitSkinGalleryDropDown(skinGallery);
            var mnustyle = OptConfig.Get <string>("Menu");

            if (mnustyle == "Taobao")
            {
                barChkTaobao.Checked = true;
            }
            else
            {
                barChkSys.Checked = true;
            }
            SqlConnectionStringBuilder bld = new SqlConnectionStringBuilder(ConnString);

            barStaticItem2.Caption  = string.Format("{0} {1}", bld.DataSource.ToString(), bld.InitialCatalog);
            barStaticItem2.Caption += " " + RemoteIP;

            //同步服务器时间
            var serverTime = (DateTime)SqlHelper.ExecuteScalar(ConnString, CommandType.Text, "select getdate()");

            TimeSync.Default.StartSync(serverTime);

            var t = new Thread(() => {
                while (true)
                {
                    Thread.Sleep(1000);
                    if (this.IsDisposed)
                    {
                        return;
                    }
                    while (!this.IsHandleCreated)
                    {
                    }
                    this.Invoke(new Action(() => {
                        barStaticItem3.Caption = TimeSync.Default.CurrentSyncTime.ToString("yyyy-MM-dd HH:mm:ss");
                    }));
                }
            });

            t.IsBackground = true;
            t.Start();

            t = new Thread(() => {
                while (true)
                {
                    Thread.Sleep(60 * 1000);
                    if (SqlHelper.ExecuteScalar(ConnString, CommandType.Text, "select 1 from t_forcedoffline where LoginMAC=@LoginMAC", new SqlParameter("@LoginMAC", LocalMAC)) != null)
                    {
                        MsgBox.ShowMessage("", "您已被管理员强制下线!");
                        GC.Collect();
                        System.Diagnostics.Process.GetCurrentProcess().Kill();
                    }
                }
            });
            t.IsBackground = true;
            t.Start();
            //加载菜单
            LoadMenu();
            if (string.Compare(OptConfig.Get <string>("Menu"), "taobao", true) == 0)
            {
                barChkTaobao.Checked = true;
                barChkSys.Checked    = false;
                foreach (NavBarGroup gp in navMenu.Groups)
                {
                    gp.Expanded = true;
                }
            }
            else
            {
                barChkSys.Checked = true; barChkTaobao.Checked = false;
            }
            var w = OptConfig.Get <int>("MenuWidth");

            if (w > 0)
            {
                this.navMenu.Width = w;
            }

            try {
                var mpv = Lanucher.Start("LS.ERP.MainPage.MainView");
                if (null != mpv)
                {
                    mpv.MdiParent = this;
                    mpv.Show();
                }
            } catch { }
            var threg = new Thread(() => { RegSelfLogin(); });

            threg.IsBackground = true;
            threg.Start();
        }