コード例 #1
0
        private void ButtonClear_OnClick(object sender, RoutedEventArgs e)
        {
            InputLogin.Clear();
            InputPassword.Clear();

            LabelShow.Text = string.Empty;
        }
コード例 #2
0
        private void ButtonClear_OnClick(object sender, RoutedEventArgs e)
        {
            InputLogin.Clear();
            InputPassword.Clear();
            ButtonAuthorization.IsEnabled = false;

            LabelShow.Text = string.Empty;
        }
コード例 #3
0
 public RegisterPage()
 {
     InitializeComponent();
     InputTicketCode.ReturnCommand   = new Command(() => InputFirstName.Focus());
     InputFirstName.ReturnCommand    = new Command(() => InputSurname.Focus());
     InputOtherRemarks.ReturnCommand = new Command(() => InputEmail.Focus());
     InputEmail.ReturnCommand        = new Command(() => InputPassword.Focus());
     InputPassword.ReturnCommand     = new Command(() => InputConfirmPassword.Focus());
 }
コード例 #4
0
ファイル: PasswordForm.cs プロジェクト: zkdlu/RemoteViewer
        private void btnOk_Click(object sender, EventArgs e)
        {
            string pw = txtPw.Text;
            InputPasswordEventArgs args = new InputPasswordEventArgs(pw);

            InputPassword?.Invoke(this, args);

            this.Close();
        }
コード例 #5
0
 private void ButtonClear_Click(object sender, RoutedEventArgs e)
 {
     InputLogin.Clear();
     InputPassword.Clear();
     InputRepeatPassword.Clear();
     LabelPasswordCheckAlphabet.Text = "";
     LabelPasswordCheckSymbols.Text  = "";
     LabelPasswordCheckLength.Text   = "";
 }
コード例 #6
0
        //loginpage actions
        //login to merchtool and passes common page object
        public MtHomePageObject Login()
        {
            InputUserName.EnterText("CORP_Webdriver");
            InputPassword.EnterText("ANapPqH<");
            BtnLogin.Click();

            Console.WriteLine("Varified input creds and logged into merchtool");
            return(new MtHomePageObject());
        }
コード例 #7
0
 public void TypeCredentials()
 {
     //Thread.Sleep(1000);
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     InputUsername.SendKeys(email);
     NextBtn.Click();
     //Thread.Sleep(1000);
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     InputPassword.SendKeys("Webapp!1");
     SignInBtn.Click();
 }
コード例 #8
0
        //login page actions
        //login to shipping manager and passes common page object
        public SmCommonPageObject Login()
        {
            //username + pw + submit
            InputUserName.SendKeys("CORP_Webdriver");
            InputPassword.SendKeys("ANapPqH<");
            BtnLogin.Submit();

            Console.WriteLine("input credentials, logged into Shipping Manager");

            //return page object
            return(new SmCommonPageObject());
        }
コード例 #9
0
        static void Main(string[] args)
        {
#if !_CONSOLE
            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif
                Directory.SetCurrentDirectory(Application.StartupPath);
                //#if !DEBUG
                Logging.OpenLogFile();
                //#endif
#if !_CONSOLE
                int try_times = 0;
                while (Configuration.Load() == null)
                {
                    if (try_times >= 5)
                        return;
                    InputPassword dlg = new InputPassword();
                    dlg.ShowDialog();
                    Configuration.SetPassword(dlg.password);
                    try_times += 1;
                }
#endif
                _controller = new ShadowsocksController();

#if !_CONSOLE
                _viewController = new MenuViewController(_controller);
#endif

                _controller.Start();

#if !_CONSOLE
                //Util.Utils.ReleaseMemory();

                Application.Run();
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }
コード例 #10
0
        public EAPageObject Login(string userName, string password)
        {
            //UserName
            InputName.EnterText(userName);
            //password
            InputPassword.EnterText(password);
            //Click button
            btnLogin.Submit();

            //Return the page object
            return(new EAPageObject());
        }
コード例 #11
0
        /// <summary>
        /// Performs the login using the <paramref name="username"/> & <paramref name="password"/>
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        public Homepage Login(string username, string password)
        {
            WaitForLoad();

            InputEmail.Clear();
            InputEmail.SendKeys(username);

            InputPassword.Clear();
            InputPassword.SendKeys(password);

            SubmitButton.Click();

            return(new Homepage(Helper.Homepage.AbsoluteUri, Helper.HomepageTitle));
        }
コード例 #12
0
        private void ButtonRegister_Click(object sender, RoutedEventArgs e)
        {
            string login    = InputLogin.Text;
            string password = InputPassword.Password;

            if (login.Length < 5 || password.Length < 5)
            {
                MessageBox.Show("Некоректная длина", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            DBConnection db = new DBConnection();

            db.AddAccount(login, password);
            MessageBox.Show("Аккаунт был успешно добавлен", "Успех!", MessageBoxButton.OK, MessageBoxImage.Information);
            InputLogin.Clear();
            InputPassword.Clear();
        }
コード例 #13
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     //if (Input.GetKeyDown(KeyCode.F))
     {
         StartCoroutine(waiting());
         InsideBuilding.SetActive(false);
         MainPlanet.SetActive(true);
         player.transform.position = spawnpoint.gameObject.transform.position;
         player.gameObject.GetComponent <Unit_Controller>().Planet = MainPlanet;
         player.gameObject.GetComponent <Unit_Controller>().grav   = newgrav;
         Alphabet.gameObject.SetActive(false);
         InputPassword.SetActive(false);
         Gate.SetActive(false);
         camera.gameObject.GetComponent <Camera_Follow>().Player        = newFollowObject;
         camera.gameObject.GetComponent <Camera>().orthographicSize     = 1;
         entrance.gameObject.GetComponent <ChangePartsinLevel>().inMain = true;
         bff.SetActive(true);
         savage.SetActive(true);
         ce.SetActive(true);
     }
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: wiriya4777/boy
        static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Utils.GetExecutablePath()));
#if !_CONSOLE
            foreach (var arg in args)
            {
                if (arg == "--setautorun")
                {
                    if (!AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }
                    return;
                }
            }
            using (var mutex = new Mutex(false, "Global\\ShadowsocksR_" + Directory.GetCurrentDirectory().GetDeterministicHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + Environment.NewLine +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif

#if !_CONSOLE
                var tryTimes = 0;
                while (Configuration.Load() == null)
                {
                    if (tryTimes >= 5)
                        return;
                    using (var dlg = new InputPassword())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                            Configuration.SetPassword(dlg.password);
                        else
                            return;
                    }
                    tryTimes += 1;
                }
#endif

                _controller = new ShadowsocksController();
                HostMap.Instance().LoadHostFile();

                // Logging
                Logging.DefaultOut = Console.Out;
                Logging.DefaultError = Console.Error;

#if _DOTNET_4_0
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

#endif
#if !_CONSOLE
                _viewController = new MenuViewController(_controller);
                SystemEvents.SessionEnding += _viewController.Quit_Click;
#endif

                _controller.Start();

#if !_CONSOLE

                Application.Run();
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }
コード例 #15
0
ファイル: App.cs プロジェクト: aicl/Calamar.Scripts
		public void Show()
		{
			Container = Div.CreateContainer(default(Element), container=>{
				Div.CreateRow(container, row=>{
					//
					new Div(row,element=>{

						element.ClassName="span4 offset4 well";
						new Legend(element, new LegendConfig{Text="Por favor inicie session"});
						
						new Form(element, fe=>{
							fe.Action= Config.Action;
							fe.Method = Config.Method;

							var cg = Div.CreateControlGroup(fe);
							
							var user= new InputText(cg.Element(), pe=>{
								pe.ClassName="span4";
								pe.SetPlaceHolder("nombre de usuario");
								pe.Name="UserName";
							});
							
							cg = Div.CreateControlGroup(fe);
							var pass =new InputPassword(cg.Element(), pe=>{
								pe.ClassName="span4";
								pe.SetPlaceHolder("Digite su clave");
								pe.Name="Password";
							});
																												
							var bt = new SubmitButton(fe, b=>{
								b.JSelect().Text("Iniciar Session");
								b.ClassName="btn btn-info btn-block";
								b.LoadingText("  autenticando....");
							});
														
							var vo = new ValidateOptions()
								.SetSubmitHandler( f=>{
									
									bt.ShowLoadingText();
									
									jQuery.PostRequest<LoginResponse>(f.Action, f.Serialize(), cb=>{
										Cayita.Javascript.Firebug.Console.Log("callback", cb);
									},"json")
										.Success(d=>{
											UserName= user.Element().Value;
											if(OnLogin!=null) OnLogin(d,this);
											
										})
											.Error((request,  textStatus,  error)=>{
												Div.CreateAlertErrorBefore(fe.Elements[0],textStatus+": "
												                           +( request.StatusText.StartsWith("ValidationException")?
												  "Usario/clave no validos":
												  request.StatusText));
											})
											.Always(a=>{
												bt.ResetLoadingText();
											})										;
									
									
								})
									.AddRule((rule, msg)=>{
										rule.Element=pass.Element();
										rule.Rule.Minlength(2).Required();
										msg.Minlength("minimo 2 caracteres").Required("Digite su password");
									})
									
									.AddRule( (rule, msg)=> {
										rule.Element= user.Element();
										rule.Rule.Required().Minlength(2);
										msg.Minlength("minimo 2 caracteres");
									});
							
							fe.Validate(vo);			
							
						});
						
					});

				});
			});
			
			Parent.AppendChild(Container.Element());
		}
コード例 #16
0
        private static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Utils.GetExecutablePath()));
            if (args.Any(arg => arg == @"--setautorun"))
            {
                if (!AutoStartup.Switch())
                {
                    Environment.ExitCode = 1;
                }
                return;
            }

            using var mutex = new Mutex(false, $@"Global\ShadowsocksR_{Directory.GetCurrentDirectory().GetDeterministicHashCode()}");
            if (!mutex.WaitOne(0, false))
            {
                MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + Environment.NewLine +
                                I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                                I18N.GetString("ShadowsocksR is already running."));
                return;
            }

            var app = new Application
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
            app.Exit += App_Exit;

            var tryTimes = 0;

            while (Configuration.Load() == null)
            {
                if (tryTimes >= 5)
                {
                    return;
                }
                using (var dlg = new InputPassword())
                {
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Configuration.SetPassword(dlg.password);
                    }
                    else
                    {
                        return;
                    }
                }
                tryTimes += 1;
            }

            _controller = new ShadowsocksController();
            HostMap.Instance().LoadHostFile();

            // Logging
            Logging.DefaultOut   = Console.Out;
            Logging.DefaultError = Console.Error;

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            _viewController             = new MenuViewController(_controller);
            SystemEvents.SessionEnding += _viewController.Quit_Click;

            _controller.Start();
            app.Run();
        }
コード例 #17
0
 private void FillPassword()
 {
     Driver.WaitForElementExist(By.XPath("//input[@id=\'signin_password\']"), 10);
     InputPassword.Clear();
     InputPassword.SendKeys(Base.Password);
 }
コード例 #18
0
        private void ButBalance_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                _saleOrder.HowBalance = RadBanlanceModeCash.IsChecked.HasValue && RadBanlanceModeCash.IsChecked.Value
                    ? (SByte)DataType.SaleOrderBalancedMode.Cash
                    : RadBanlanceModeCard.IsChecked.HasValue && RadBanlanceModeCard.IsChecked.Value
                        ? (SByte)DataType.SaleOrderBalancedMode.MemberCard
                        : (SByte)DataType.SaleOrderBalancedMode.UnitUnionPay;

                foreach (var soProduceDomainModel in _soProduceDomainModels)
                {
                    if (soProduceDomainModel.SOProduce.Quantity < 0 &&
                        string.IsNullOrEmpty(soProduceDomainModel.SOProduce.Description))
                    {
                        MessageBox.Show(string.Format("商品'{0}'数量小于零,确认数量或填写备注说明。", soProduceDomainModel.SOProduce.Produce.Name),
                                        Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    else if (ResourcesHelper.CurrentUserRolePermission.SaleOrderFavorableLimitCost &&
                             soProduceDomainModel.SOProduce.DiscountRate <
                             soProduceDomainModel.SOProduce.Produce.LowestDiscountRate)
                    {
                        MessageBox.Show(string.Format("商品'{0}'折扣过低, 要赔钱了!", soProduceDomainModel.SOProduce.Produce.Name),
                                        Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                }

                if (_balanceDomainModel.DiscountPrice > 0)
                {
                    if (!ResourcesHelper.CurrentUserRolePermission.SaleOrderFavorableCost &&
                        _balanceDomainModel.DiscountPrice > float.Parse(ResourcesHelper.SystemSettings[(short)DataType.SystemSettingCode.SOProduceGeneralMangerMaxDiscountPrice]))
                    {
                        MessageBox.Show("结算失败, 优惠金额超过上限, 要赔钱卖了!", Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }

                    if (_balanceDomainModel.DiscountPrice > _balanceDomainModel.TotalPrice)
                    {
                        MessageBox.Show("结算失败, 优惠金额大于应收金额, 要赔钱卖了!", Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                }

                if (RadBanlanceModeCash.IsChecked != null && (bool)RadBanlanceModeCash.IsChecked)
                {
                    if ((_balanceDomainModel.ReturnedPrice < 0))
                    {
                        MessageBox.Show("结算失败, 实收金额小于应收金额, 要多找钱了!", Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }

                    if (_user.UserId > 0)
                    {
                        _user.Userlogs.Add(new Userlog
                        {
                            ChangedBy   = ResourcesHelper.CurrentUser.Name,
                            LogType     = (sbyte)DataType.MemberCardLogType.Consumption,
                            DateChanged = DateTime.Now,
                            NewValue    = string.Format(
                                ResourcesHelper.UserLogSaleOrderFormat,
                                _saleOrder.SaleOrderNo,
                                CommonHelper.Enumerate <DataType.SaleOrderBalancedMode>().First(x => x.Key == _saleOrder.HowBalance).Value,
                                _balanceDomainModel.ReceivedPrice.ToString("F2"),
                                _balanceDomainModel.CurrentMemberPoints.ToString("F2"),
                                (_balanceDomainModel.SurplusPrice > 0 ? _balanceDomainModel.SurplusPrice : 0).ToString("F2"),
                                (_balanceDomainModel.CurrentMemberPoints + _balanceDomainModel.MemberPoints).ToString("F2"))
                        });

                        _saleOrder.PurchaseOrderUserId = _user.UserId == 0 ? (int?)null : _user.UserId;
                        _user.MemberPoints            += _balanceDomainModel.ReceivedPrice * float.Parse(ResourcesHelper.SystemSettings[(short)DataType.SystemSettingCode.MemberPointsRate]);

                        _userRepository.Update(_user);
                    }
                }
                else if (RadBanlanceModeCard.IsChecked != null && (bool)RadBanlanceModeCard.IsChecked)
                {
                    if (_memberCard.MemberCardId > 0)
                    {
                        if (_balanceDomainModel.SurplusPrice < 0 ||
                            _memberCard.TotalSurplusMoney - _balanceDomainModel.ReceivedPrice < 0)
                        {
                            MessageBox.Show("结算失败, 购物卡余额不足, 请用充值或现金结算!", Properties.Resources.SystemName,
                                            MessageBoxButton.OK, MessageBoxImage.Warning);
                            return;
                        }

                        InputPassword inputPassword = new InputPassword(_memberCard.MemberCardId);
                        inputPassword.ShowDialog();
                        if (!inputPassword.IsCheckOK)
                        {
                            return;
                        }

                        float saveMoney = _balanceDomainModel.ReceivedPrice *
                                          (_memberCard.PrincipalSurplusMoney / _memberCard.TotalSurplusMoney);

                        if (_memberCard.FavorableSurplusMoney >= (_balanceDomainModel.ReceivedPrice - saveMoney))
                        {
                            _memberCard.FavorableSurplusMoney -= (_balanceDomainModel.ReceivedPrice - saveMoney);
                            _memberCard.PrincipalSurplusMoney -= saveMoney;
                        }
                        else
                        {
                            _memberCard.PrincipalSurplusMoney -= _balanceDomainModel.ReceivedPrice -
                                                                 _memberCard.FavorableSurplusMoney;
                            _memberCard.FavorableSurplusMoney -= _memberCard.FavorableSurplusMoney;
                        }
                        _memberCard.TotalSurplusMoney -= _balanceDomainModel.ReceivedPrice;

                        _memberCard.MemberCardlogs.Add(new DataModel.Model.MemberCardLog
                        {
                            FavorableMoney = (_balanceDomainModel.ReceivedPrice - saveMoney),
                            PrincipalMoney = saveMoney,
                            LogType        = (sbyte)DataType.MemberCardLogType.Consumption,
                            ChangedBy      = ResourcesHelper.CurrentUser.Name,
                            DateChanged    = DateTime.Now,
                            NewValue       = string.Format(ResourcesHelper.MemberCardLogSaleOrderFormat,
                                                           _saleOrder.SaleOrderNo,
                                                           CommonHelper.Enumerate <DataType.SaleOrderBalancedMode>()
                                                           .First(x => x.Key == _saleOrder.HowBalance)
                                                           .Value,
                                                           _balanceDomainModel.ReceivedPrice.ToString("F2"),
                                                           _balanceDomainModel.CurrentMemberPoints.ToString("F2"),
                                                           (_balanceDomainModel.SurplusPrice > 0 ? _balanceDomainModel.SurplusPrice : 0)
                                                           .ToString("F2"),
                                                           (_balanceDomainModel.CurrentMemberPoints + _balanceDomainModel.MemberPoints)
                                                           .ToString("F2"))
                        });
                        _memberCardRepository.Update(_memberCard);
                    }

                    if (_user.UserId > 0)
                    {
                        float saveMoney = _balanceDomainModel.ReceivedPrice *
                                          (_user.CashBalance / _user.CashTotal);

                        if (_user.CashFee >= (_balanceDomainModel.ReceivedPrice - saveMoney))
                        {
                            _user.CashFee     -= (_balanceDomainModel.ReceivedPrice - saveMoney);
                            _user.CashBalance -= saveMoney;
                        }
                        else
                        {
                            _user.CashBalance -= _balanceDomainModel.ReceivedPrice - _user.CashFee;
                            _user.CashFee     -= _user.CashFee;
                        }
                        _user.CashTotal -= _balanceDomainModel.ReceivedPrice;

                        _user.Userlogs.Add(new Userlog
                        {
                            ChangedBy   = ResourcesHelper.CurrentUser.Name,
                            DateChanged = DateTime.Now,
                            LogType     = (sbyte)DataType.MemberCardLogType.Consumption,
                            NewValue    = string.Format(
                                ResourcesHelper.UserLogSaleOrderFormat,
                                _saleOrder.SaleOrderNo,
                                CommonHelper.Enumerate <DataType.SaleOrderBalancedMode>()
                                .First(x => x.Key == _saleOrder.HowBalance)
                                .Value,
                                _balanceDomainModel.ReceivedPrice.ToString("F2"),
                                _balanceDomainModel.CurrentMemberPoints.ToString("F2"),
                                (_balanceDomainModel.SurplusPrice > 0 ? _balanceDomainModel.SurplusPrice : 0).ToString(
                                    "F2"),
                                (_balanceDomainModel.CurrentMemberPoints + _balanceDomainModel.MemberPoints).ToString(
                                    "F2"))
                        });

                        _saleOrder.PurchaseOrderUserId = _user.UserId == 0 ? (int?)null : _user.UserId;
                        _user.MemberPoints            += _balanceDomainModel.ReceivedPrice *
                                                         float.Parse(
                            ResourcesHelper.SystemSettings[
                                (short)DataType.SystemSettingCode.MemberPointsRate]);

                        _userRepository.Update(_user);
                    }
                }
                else
                {
                    _balanceDomainModel.RealPrice = _balanceDomainModel.ReceivedPrice;
                    if (_user.UserId > 0)
                    {
                        _user.Userlogs.Add(new Userlog
                        {
                            ChangedBy   = ResourcesHelper.CurrentUser.Name,
                            DateChanged = DateTime.Now,
                            LogType     = (sbyte)DataType.MemberCardLogType.Consumption,
                            NewValue    = string.Format(
                                ResourcesHelper.UserLogSaleOrderFormat,
                                _saleOrder.SaleOrderNo,
                                CommonHelper.Enumerate <DataType.SaleOrderBalancedMode>().First(x => x.Key == _saleOrder.HowBalance).Value,
                                _balanceDomainModel.ReceivedPrice.ToString("F2"),
                                _balanceDomainModel.CurrentMemberPoints.ToString("F2"),
                                (_balanceDomainModel.SurplusPrice > 0 ? _balanceDomainModel.SurplusPrice : 0).ToString("F2"),
                                (_balanceDomainModel.CurrentMemberPoints + _balanceDomainModel.MemberPoints).ToString("F2"))
                        });

                        _saleOrder.PurchaseOrderUserId = _user.UserId == 0 ? (int?)null : _user.UserId;
                        _user.MemberPoints            += _balanceDomainModel.ReceivedPrice * float.Parse(ResourcesHelper.SystemSettings[(short)DataType.SystemSettingCode.MemberPointsRate]);

                        _userRepository.Update(_user);
                    }
                }

                SaveSaleOrder(DataType.SaleOrderStatus.Balanced);

                _saleOrder.FavorableCost = _balanceDomainModel.DiscountPrice;
                _saleOrder.TotalCost     = _balanceDomainModel.ReceivedPrice;
                _saleOrder.SOProduces.ForEach(x =>
                {
                    x.Produce.Quantity -= (x.Quantity ?? 0);
                    x.Produce.Producelogs.Add(new Producelog
                    {
                        ChangedBy   = ResourcesHelper.CurrentUser.Name,
                        DateChanged = DateTime.Now,
                        NewValue    = string.Format(ResourcesHelper.ProduceLogSaleOrderFormat,
                                                    _saleOrder.SaleOrderNo,
                                                    (x.Quantity ?? 0).ToString("F2"),
                                                    (x.CostPerUnit ?? 0).ToString("F2"),
                                                    x.Produce.Quantity.ToString("F2"))
                    });
                });
                _saleOrder.SaleOrderStatus = (sbyte)DataType.SaleOrderStatus.Balanced;
                _unitOfWork.Commit();

                if (ResourcesHelper.CurrentUser.UserType != (byte)DataType.UserType.Admin)
                {
                    try
                    {
                        SaleOrderReportPrint.Print(_saleOrder);

                        MessageBox.Show("结算成功!", Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    catch (Exception ex)
                    {
                        Log4NetHelper.WriteLog(ex.ToString());

                        MessageBox.Show("结算成功, 打印小票失败!", Properties.Resources.SystemName,
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }

                SaleOrderWindow.ExecuteSearchText();
                Close();
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteLog(ex.ToString());
                MessageBox.Show("结算失败, 请重新新建零售记录!", SmallHoneybee.Wpf.Properties.Resources.SystemName,
                                MessageBoxButton.OK, MessageBoxImage.Error);

                SaleOrderWindow.ExecuteSearchText();
                Close();
            }
        }
コード例 #19
0
 private void RegisterInputPassword(string password)
 {
     InputPassword.SendKeys(password);
     LogManager.Instance.WriteToLog(LogManager.elogLevel.Debug, "enter Password: "******" to input field");
 }
コード例 #20
0
        static void Main(string[] args)
        {
#if !_CONSOLE
            foreach (string arg in args)
            {
                if (arg == "--setautorun")
                {
                    if (!Controller.AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }
                    return;
                }
            }
            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif
                Directory.SetCurrentDirectory(Application.StartupPath);
                //#if !DEBUG
                Logging.OpenLogFile();
                //#endif
#if !_CONSOLE
                int try_times = 0;
                while (Configuration.Load() == null)
                {
                    if (try_times >= 5)
                        return;
                    using (InputPassword dlg = new InputPassword())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                            Configuration.SetPassword(dlg.password);
                        else
                            return;
                    }
                    try_times += 1;
                }
#endif
                //  _controller = new ShadowsocksController();
                // HostMap.Instance().LoadHostFile();
#if !_CONSOLE
                //   _viewController = new MenuViewController(_controller);
#endif

                // _controller.Start();

#if !_CONSOLE
                //  Util.Utils.ReleaseMemory();

                // Application.Run(new UserLoginForm());
                Application.Run(new ConfigForm(new ShadowsocksController(), new UpdateChecker(), 1));
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }
コード例 #21
0
        static void Main(string[] args)
        {

            if (Utils.IsVirusExist())
            {
                return;
            }
#if !_CONSOLE
                foreach (string arg in args)
            {
                if (arg == "--setautorun")
                {
                    if (!AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }
                    return;
                }
            }

            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);
                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif
                Directory.SetCurrentDirectory(Application.StartupPath);

#if !_CONSOLE
                int try_times = 0;
                while (Configuration.Load() == null)
                {
                    if (try_times >= 5)
                        return;
                    using (InputPassword dlg = new InputPassword())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                            Configuration.SetPassword(dlg.password);
                        else
                            return;
                    }
                    try_times += 1;
                }
                //if (try_times > 0)
                //    Logging.save_to_file = false;
#endif

                Logging.OpenLogFile();

                ServicePointManager.DefaultConnectionLimit = 512;
#if _DOTNET_4_0
                // Enable Modern TLS when .NET 4.5+ installed.
                if (EnvCheck.CheckDotNet45())
                    ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;//(SecurityProtocolType)3072;
                if (EnvCheck.CheckDotNet471())
                    ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls13;
#endif
                ServicePointManager.SecurityProtocol |= SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;


                _controller = new ShadowsocksController();
                HostMap.Instance().LoadHostFile();

#if !_CONSOLE
                _viewController = new MenuViewController(_controller);
#endif
                _controller.Start();
                SystemEvents.SessionEnding += _viewController.Quit_Click;

#if !_CONSOLE

                foreach (string arg in args)
                {
                    if (arg == "-Direct")
                    {
                        _viewController.DirectItem_Click();
                        break;
                    }
                    else if(arg == "-Pac")
                    {
                        _viewController.PACModeItem_Click();
                        break;
                    }
                    else if(arg == "-Global")
                    {
                        _viewController.GlobalModeItem_Click();
                        break;
                    }
                }

                Application.Run();
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }
コード例 #22
0
        /// <summary>
        /// Reads the carrier image and calls Hide/Extract.
        /// </summary>
        public void Execute()
        {
            ProgressChanged(0, 1);

            if (InputCarrier == null)
            {
                GuiLogMessage("Please provide an input carrier.", NotificationLevel.Error);
                return;
            }

            if (InputPassword == null || InputPassword.Length == 0)
            {
                GuiLogMessage("Please provide a password.", NotificationLevel.Error);
                return;
            }

            if (InputData == null && settings.Action == 0)
            {
                GuiLogMessage("Please provide a message.", NotificationLevel.Error);
                return;
            }

            currentColorComponent = 0;

            using (CStreamReader reader = InputCarrier.CreateReader())
            {
                using (Bitmap bitmap = new Bitmap(reader))
                {
                    switch (settings.Action)
                    {
                    case 0:     // hide message
                        this.imageInfo = null;

                        //make sure that the image is in RGB format
                        Bitmap image = PaletteToRGB(bitmap);

                        if (settings.CustomizeRegions)
                        {
                            hidedialog = new RegionHideForm(image, (int)InputData.Length);
                            if (hidedialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                            {
                                return;
                            }
                            this.imageInfo = hidedialog.ImageInfo;
                        }

                        if (this.imageInfo == null)
                        {
                            CreateDefaultImageInfo(image);

                            if (imageInfo.Capacity < InputData.Length)
                            {
                                GuiLogMessage("The defined regions can only hold " + imageInfo.Capacity + " bytes of information, but the input consists of " + InputData.Length + " bytes.", NotificationLevel.Error);
                                return;
                            }

                            GuiLogMessage("The carrier image can hide " + imageInfo.Capacity + " bytes of information.", NotificationLevel.Info);
                        }

                        Hide(image, InputData.CreateReader(), InputPassword.CreateReader());
                        OnPropertyChanged("OutputCarrier");
                        break;

                    case 1:     // extract message
                        try
                        {
                            Extract(bitmap, InputPassword.CreateReader());
                            OnPropertyChanged("OutputData");

                            if (settings.ShowRegions)
                            {
                                extractdialog = new RegionExtractForm(this.imageInfo);
                                extractdialog.ShowDialog();
                            }
                        }
                        catch (Exception ex)
                        {
                            GuiLogMessage("Wrong key or nothing hidden in the picture", NotificationLevel.Warning);
                            return;
                        }
                        break;
                    }
                }
            }

            ProgressChanged(1, 1);
        }
コード例 #23
0
        static void Main(string[] args)
        {
#if !_CONSOLE
            foreach (string arg in args)
            {
                if (arg == "--setautorun")
                {
                    if (!Controller.AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }
                    return;
                }
            }
            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + Environment.NewLine +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif
                Directory.SetCurrentDirectory(Application.StartupPath);

#if !_CONSOLE
                int try_times = 0;
                while (Configuration.Load() == null)
                {
                    if (try_times >= 5)
                        return;
                    using (InputPassword dlg = new InputPassword())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                            Configuration.SetPassword(dlg.password);
                        else
                            return;
                    }
                    try_times += 1;
                }
#endif

                _controller = new ShadowsocksController();
                HostMap.Instance().LoadHostFile();

                // Logging
                Configuration cfg = _controller.GetConfiguration();
                Logging.save_to_file = cfg.logEnable;

                //#if !DEBUG
                if (try_times > 0)
                    Logging.save_to_file = false;
                Logging.OpenLogFile();
                //#endif

#if _DOTNET_4_0
                // Enable Modern TLS when .NET 4.5+ installed.
                if (Util.EnvCheck.CheckDotNet45())
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif
#if !_CONSOLE
                _viewController = new MenuViewController(_controller);
#endif

                _controller.Start();

#if !_CONSOLE
                //Util.Utils.ReleaseMemory();

                Application.Run();
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }
コード例 #24
0
        public LoginPage()
        {
            InitializeComponent();

            InputEmail.ReturnCommand = new Command(() => InputPassword.Focus());
        }
コード例 #25
0
ファイル: SignIn.xaml.cs プロジェクト: Sar-dim/Wpf-chat
 private void ButtonClear_Click(object sender, RoutedEventArgs e)
 {
     InputLogin.Clear();
     InputPassword.Clear();
     LabelCheck.Text = "";
 }
コード例 #26
0
ファイル: RegisterPage.cs プロジェクト: Janjuha/TestProject
 public void TypePassword()
 {
     InputPassword.SendKeys("Webapp!1");
     ConfirmPassword.SendKeys("Webapp!1");
 }