Beispiel #1
0
        void Handle_Next(object sender, EventArgs e)
        {
            if (PwdEntry.Text == null)
            {
                DisplayAlert("Notice", "Please enter your password and make sure it's least 8 characters. ", "OK");
            }
            else
            {
                Pwd = PwdEntry.Text;
                if (Pwd.Length < 8)
                {
                    DisplayAlert("No Access", "Please enter your password and make sure it's least 8 characters!", "OK");
                    return;
                }
                try
                {
                    Uac uac = new Uac();
                    uac.ContactNo = ContactNo;
                    uac.UserID    = Settings.UserId;
                    uac.Pwd       = Pwd;
                    uih.UpdateUac(uac);

                    Navigation.PushAsync(new SignInPage());
                }
                catch (SystemException ex)
                {
                    Console.WriteLine(ex);
                    return;
                }
            }
        }
        internal void UpdateUac(Uac ac)
        {
            //建立数据库连接
            MySqlConnection conn = new MySqlConnection(connStr);

            try
            {   //建立连接,打开数据库
                conn.Open();
                string sqlstr =
                    "UPDATE UserMaster SET " +
                    "ContactNo = @para3, " +
                    "Pwd = @para4" +
                    " WHERE Uid = @para1";
                MySqlCommand cmd = new MySqlCommand(sqlstr, conn);
                //通过设置参数的形式给SQL 语句串值
                cmd.Parameters.AddWithValue("para1", ac.UserID);
                cmd.Parameters.AddWithValue("para3", ac.ContactNo);
                cmd.Parameters.AddWithValue("para4", ac.Pwd);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                conn.Close();   //关闭连接
            }
        }
        public Uac GetUacByID(string userid)
        {
            Uac ac = new Uac();
            //并没有建立数据库连接
            MySqlConnection conn = new MySqlConnection(connStr);

            try
            {   //建立连接,打开数据库
                conn.Open();
                string sqlstr =
                    "SELECT * FROM UserMaster WHERE Uid = @para1";
                MySqlCommand cmd = new MySqlCommand(sqlstr, conn);
                //通过设置参数的形式给SQL 语句串值
                cmd.Parameters.AddWithValue("para1", userid);

                MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    ac.UserID    = reader.GetString(0);
                    ac.ContactNo = reader.GetString(1);
                    ac.Pwd       = reader.GetString(2);
                }
                return(ac);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
            finally
            {
                conn.Close();   //关闭连接
            }
        }
        private void SetupForm_Load(object sender, EventArgs e)
        {
            // show application version
            Text += @" " + AssemblyHelper.Version + @" - Setup";

            // make sure that game is not running
            if (Ets2ProcessHelper.IsEts2Running)
            {
                MessageBox.Show(this,
                                @"In order to proceed the ETS2 game must not be running." + Environment.NewLine +
                                @"Please exit the game and try again.", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.Abort;
                return;
            }

            // make sure that we have Administrator rights
            if (!Uac.IsProcessElevated())
            {
                try
                {
                    // we have to restart the setup with Administrator privileges
                    Uac.RestartElevated();
                    DialogResult = DialogResult.Abort;
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
                finally
                {
                    // if succeeded or user declined elevation
                    // then we just exit from the current process
                    Environment.Exit(0);
                }
            }

            // update UI
            foreach (var step in SetupManager.Steps)
            {
                if (step is PluginSetup)
                {
                    _setupStatusImages.Add(step, pluginStatusImage);
                }
                else if (step is FirewallSetup)
                {
                    _setupStatusImages.Add(step, firewallStatusImage);
                }
                else if (step is UrlReservationSetup)
                {
                    _setupStatusImages.Add(step, urlReservationStatusImage);
                }
                SetStepStatus(step, step.Status);
            }
        }
 public ProfilePage(User user)
 {
     InitializeComponent();
     _usr                = user;
     NameCell.Title      = user.FirstName + " " + user.LastName;
     NameCell.IconSource = user.Icon;
     FirstName           = user.FirstName;
     LastName            = user.LastName;
     _ac            = uih.GetUacByID(user.UserID);
     Email          = _ac.Email;
     PhoneNumber    = _ac.ContactNo;
     BindingContext = this;
 }
Beispiel #6
0
 public AccountPage(UserInfo currentUser)
 {
     _usr = currentUser;
     InitializeComponent();
     NameCell.Title      = _usr.FirstName + " " + _usr.LastName;
     NameCell.IconSource = _usr.Icon;
     FirstName           = _usr.FirstName;
     LastName            = _usr.LastName;
     _ac            = ush.GetUacByID(_usr.UserID);
     Email          = _usr.Email;
     PhoneNumber    = _ac.ContactNo;
     BindingContext = this;
     SetupAWSCredentials();
 }
Beispiel #7
0
        void ProgressDialog_Load(object sender, EventArgs e)
        {
            banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");

            if (!WindowsIdentity.GetCurrent().IsAdmin() && Uac.IsEnabled())
            {
                this.waitPrompt.Text    = Runtime.Session.Property("UAC_WARNING");
                this.waitPrompt.Visible = true;
            }

            ResetLayout();

            Shell.StartExecute();
        }
        void ProgressDialog_Load(object sender, EventArgs e)
        {
            // ReSharper disable twice StringLiteralTypo
            MsiRuntime.Session["PIDPARAM"] = Process.GetCurrentProcess().Id.ToString();
            MsiRuntime.Session["EXENAME"]  = MsiRuntime.InstallDir.PathCombine(Program.Executable);

            banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");

            if (!WindowsIdentity.GetCurrent().IsAdmin() && Uac.IsEnabled())
            {
                waitPrompt.Text = Runtime.Session.Property("UAC_WARNING");

                showWaitPromptTimer.Start();
            }

            ResetLayout();

            Shell.StartExecute();
        }
        static void Main(string[] args)
        {
            // check if another instance is running
            CreateMutex(0, -1,
                        Uac.IsProcessElevated()
                    ? "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001_UAC"
                    : "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001");
            bool bAnotherInstanceRunning = GetLastError() == ErrorAlreadyExists;

            if (bAnotherInstanceRunning)
            {
                return;
            }

            log4net.Config.XmlConfigurator.Configure();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            UninstallMode = args.Length >= 1 && args.Any(a => a.Trim() == "-uninstall");

            Application.Run(new MainForm());
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            // check if another instance is running
            CreateMutex(0, -1,
                        Uac.IsProcessElevated()
                    ? "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001_UAC"
                    : "Ets2Telemetry_8F63CCBE353DE22BD1A86308AD675001");
            bool bAnotherInstanceRunning = GetLastError() == ErrorAlreadyExists;

            if (bAnotherInstanceRunning && !args.Any(a => a.Trim() == "-restart"))
            {
                MessageBox.Show(@"Another ETS2/ATS Telemetry Server instance is already running!", @"Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            log4net.Config.XmlConfigurator.Configure();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            UninstallMode = args.Length >= 1 && args.Any(a => a.Trim() == "-uninstall");

            Application.Run(new MainForm());
        }
Beispiel #11
0
        //登入按钮 Sign In
        async void Handle_SignIn(object sender, EventArgs e)
        {
            activity.IsEnabled      = true;
            activity.IsRunning      = true;
            activity.IsVisible      = true;
            signInloading.Text      = "Connecting...";
            signInloading.TextColor = Color.FromHex("#FF4E18");
            UserAccess userAccess = new UserAccess();
            Uac        uac        = new Uac();

            uac.ContactNo = GetCountryName(countryCodePicker.SelectedItem.ToString()) + PNumEntry.Text;

            //Internet Connection Check
            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                await DisplayAlert("No Internet", "Try again later!", "OK");

                activity.IsEnabled = false;
                activity.IsRunning = false;
                activity.IsVisible = false;
                signInloading.Text = "";
                return;
            }

            //Empty Check
            if (PNumEntry.Text.IsNullOrEmpty())
            {
                await DisplayAlert("Error", "Try enter your Number and try again!", "OK");

                activity.IsEnabled = false;
                activity.IsRunning = false;
                activity.IsVisible = false;
                signInloading.Text = "";
                return;
            }

            //Validation Check
            if (!thelper.IsValidE164(uac.ContactNo, "US"))
            {
                await DisplayAlert("Not Valid", "Enter a real number and try again!", "OK");

                activity.IsEnabled = false;
                activity.IsRunning = false;
                activity.IsVisible = false;
                signInloading.Text = "";
                return;
            }

            //RememberMe = savename.IsToggled;
            if (userAccess.CheckPhoneNoExist(uac.ContactNo))
            {
                Settings.UserId    = userAccess.GetUserIDbyNo(uac.ContactNo);
                activity.IsEnabled = false;
                activity.IsRunning = false;
                activity.IsVisible = false;
                signInloading.Text = "";
                await Navigation.PushAsync(new SignInPasswordPage(uac.ContactNo));
            }
            else
            {
                if (uac.ContactNo.Remove(3) == "+86")
                {
                    userAccess.SendverifyCodeYP(uac.ContactNo.Substring(3), userAccess.GetVerificationCode());
                    activity.IsEnabled = false;
                    activity.IsRunning = false;
                    activity.IsVisible = false;
                    signInloading.Text = "";
                    await Navigation.PushAsync(new SignUpVerifyPage(uac.ContactNo));
                }
                else
                {
                    userAccess.TwilioVerifyService(uac.ContactNo);
                    activity.IsEnabled = false;
                    activity.IsRunning = false;
                    activity.IsVisible = false;
                    signInloading.Text = "";
                    await Navigation.PushAsync(new SignUpVerifyPage(uac.ContactNo));
                }
            }
        }
 public ResetPasswordPage(Uac ac)
 {
     _ac = ac;
     Init();
 }