Esempio n. 1
0
        /// <summary>
        /// 保存本地设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void krpbChangeLocal_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(krptServerIP.Text.Trim()))
            {
                KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("LoginValid"), Resources.GetRes().GetString("ServerIpAddress2")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }



            int lang = Resources.GetRes().GetLangByLangName(krpcLanguage.SelectedItem.ToString()).LangIndex;

            string cashDrawerValue    = (krpcbCashDrawer.Text == Resources.GetRes().GetString("None") ? "" : krpcbCashDrawer.Text);
            string priceMonitorValue  = (krpcbPriceMonitor.Text == Resources.GetRes().GetString("None") ? "" : krpcbPriceMonitor.Text);
            string barcodeReaderValue = (krpcbBarcodeReader.Text == Resources.GetRes().GetString("None") ? "" : krpcbBarcodeReader.Text);
            string cardReaderValue    = (krpcbCardReader.Text == Resources.GetRes().GetString("None") ? "" : krpcbCardReader.Text);

            if (Config.GetConfig().SetConfig(lang, krptServerIP.Text.Trim(), krpcIsLocalPrint.Checked, IsOnlyLocal, cashDrawerValue, priceMonitorValue, barcodeReaderValue, cardReaderValue))
            {
                string msg = "";
                if (IsOnlyLocal)
                {
                    msg = Resources.GetRes().GetString("OperateSuccess");
                }
                else
                {
                    msg = Resources.GetRes().GetString("OperateChangeNextStartup");
                }
                KryptonMessageBox.Show(this, string.Format(msg, Resources.GetRes().GetString("Change")), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (krpcLanguage.SelectedIndex != lastLangIndex && IsOnlyLocal)
                {
                    Resources.GetRes().ReloadResources(lang);
                    PaletteBlue.GetSelf().Reload();
                    //重新加载文字
                    ConfigString.GetConfigString().Config();

                    SetLang();

                    if (null != ChangeLang)
                    {
                        ChangeLang(null, null);
                    }
                }

                if (null != ChangeLocalSet)
                {
                    ChangeLocalSet(null, null);
                }

                if (IsOnlyLocal)
                {
                    this.Close();
                }
            }
            else
            {
                KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("OperateFaild"), krpbChangeLocal.Text), Resources.GetRes().GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Esempio n. 2
0
        public LoginWindow()
        {
            InitializeComponent();
            krpManagerLogin.GlobalPaletteMode = PaletteModeManager.Custom;
            krpManagerLogin.GlobalPalette     = PaletteBlue.GetSelf();
            //加载文字
            ConfigString.GetConfigString().Config();
            this.Visible = false;
            //加载配置文件
            Config.GetConfig().GetConfigs(true);

            this.Tag = "Main";
            SetLang();


            Assembly asm = Assembly.LoadFrom(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Res.dll"));

            this.Icon = new Icon(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.Login.ico"));
            krpbSetting.StateCommon.Back.Image      = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.ChangeSet.png"));
            krpbSetting.StateCommon.Back.ImageStyle = PaletteImageStyle.Stretch;
            krpbSetting.StateCommon.Back.Draw       = InheritBool.True;

            if (int.Parse(Resources.GetRes().GetString("HightFix")) != 0)
            {
                krptAdminNo.Location  = new Point(krptAdminNo.Location.X, krptAdminNo.Location.Y + int.Parse(Resources.GetRes().GetString("HightFix")).RecalcMagnification2());
                krptPassword.Location = new Point(krptPassword.Location.X, krptPassword.Location.Y + int.Parse(Resources.GetRes().GetString("HightFix")).RecalcMagnification2());
            }

            // 这个先在这里预先执行一下免得后续无法得到值
            this.GetMagnification();

            Common.GetCommon().ReadBak();

            krptAdminNo.Text = Resources.GetRes().LastLoginAdminNo;

            if (!string.IsNullOrWhiteSpace(krptAdminNo.Text))
            {
                krptPassword.Select();
            }


            this.Shown += (x, y) =>
            {
                if (!_isLoaded)
                {
                    _isLoaded = true;

                    this.WindowState = FormWindowState.Normal;

                    System.Windows.Size         size   = new System.Windows.Size();
                    System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromRectangle(new System.Drawing.Rectangle(this.Location.X, this.Location.Y, this.Width, this.Height));

                    size.Width  = screen.WorkingArea.Width;
                    size.Height = screen.WorkingArea.Height;

                    Res.Resources.GetRes().setSize(size);
                }
            };
        }
Esempio n. 3
0
        private void SetLang()
        {
            PaletteBlue.GetSelf().Reload();
            //重新加载文字
            ConfigString.GetConfigString().Config();


            //加载语言
            this.Font         = new Font(Resources.GetRes().GetString("FontName2"), float.Parse(Resources.GetRes().GetString("FontSize")));
            this.Text         = Resources.GetRes().GetString("UserLogin");
            krplAdminNo.Text  = Resources.GetRes().GetString("AdminNo");
            krplPassword.Text = Resources.GetRes().GetString("Password");
            krpbLogin.Text    = Resources.GetRes().GetString("Login");

            krpbExit.Text = Resources.GetRes().GetString("Exit");
        }