Example #1
0
        protected override void Initialize()
        {
            spriteManager = new SpriteManager(this);
            Components.Add(spriteManager);

            base.Initialize();

            gameGateway.OnGameFinished += GameFinishedHandler;

            LoginForm loginForm = new LoginForm();
            loginForm.OnStartWithAI += (nickname) =>
            {
                gameGateway.SpriteManager = spriteManager;
                gameGateway.StartGame();
            };
            loginForm.OnStartWithNetUser += (nickname) => { MessageBox.Show("Comming soon"); };
            loginForm.OnAboutShow += () =>
            {
                About about = new About();
                about.ShowDialog();
            };
            loginForm.OnExit += () => { _exitCommand = true; };

            loginForm.ShowDialog();
        }
Example #2
0
        /** Excel Related Data Members **/
        public AdminMain(TCPIPconnectorClient newConnection, LoginForm form)
        {
            InitializeComponent();

            oldForm = form;
            adminClient = newConnection; //Store the reference in here

            adminQuestionCase = 0;  //Data member used for case statement
            timerCountDown    = 11; //Timer always begins at 10, then decrements

            randNumber = new Random(); //Default constructor to initiliaze the Random object

            accessPoint = new object();

            /*** UI RELATED DATA MEMBERS ***/
            /** Disable textbox and label for initial startup **/

            Question_To_Ask_Admin.Visible  = false; //Hide the question
            Write_Info_Msg_Box.Visible     = false; //Hide the writing information textbox
            Multi_Choice_Error_Msg.Visible = false;
            Error_Message.Visible  = false;  //Hide the error message for now
            Submit_Content.Enabled = false;  //Disable the submit button

            MultiChoiceA.Visible = false;
            MultiChoiceB.Visible = false;
            MultiChoiceC.Visible = false;

            ChoiceBText.Visible = false;
            ChoiceCText.Visible = false;
            ChoiceDText.Visible = false;
        }
Example #3
0
		public void TestLoginCredentials(string loginName, string loginPassword)
		{
			LoginForm loginForm = null;

			// Ensure construction, opening and closing doesn't fail.
			Assert.DoesNotThrow(
				() =>
				{
					loginForm = new LoginForm("http://www.workshare.com")
						{
							LoginName = loginName,
							LoginPassword = loginPassword
						};
					loginForm.Show();
					Application.DoEvents();
					loginForm.Close();
					Application.DoEvents();
				},
				"Failed to show login form.");

			Assert.NotNull(loginForm, "Login form should not be null.");

			// The returned username should be the same as was set.
			// Unless the input was null, in which case an empty string is returned.
			Assert.AreEqual((loginName ?? string.Empty), loginForm.LoginName, "The user name was not as expected.");

			// The returned password should always be an empty string,
			// because the password would not have been entered.
			Assert.AreEqual(string.Empty, loginForm.LoginPassword, "The password was not as expected.");
		}
Example #4
0
        public MainForm()
        {
            InitializeComponent();

            this._systemMessageText = new DefineConstantValue.SystemMessage(string.Empty);
            this._isLogin = false;

            this._tmrDisplayTime = new Timer();
            this._tmrDisplayTime.Interval = 1000;
            this._tmrDisplayTime.Tick += new EventHandler(_tmrDisplayTime_Tick);
            this._tmrDisplayTime.Enabled = true;

            this._tmrRefreshStatus = new Timer();
            this._tmrRefreshStatus.Interval = 500;
            this._tmrRefreshStatus.Tick += new EventHandler(_tmrRefreshStatus_Tick);
            this._tmrRefreshStatus.Enabled = false;

            OnStatusBarChanged += new StatusBarRefresh(MainForm_OnStatusBarChanged);

            this.BaseDockPanel = this.dpnlContainer;

            this._win = new LoginForm();

            Cursor.Current = Cursors.WaitCursor;

            //this.Text = this._systemMessageText.strSystemText;

            Cursor.Current = Cursors.Arrow;

            this._strNoticeFormName = "WindowUI.HBManagerTerminal.Notice.frmNoticeShow";
        }
Example #5
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Initialize();
            CommandData = commandData;
            //Login
            using(var login = new LoginForm())
            {
                login.ShowDialog();
                if(login.DialogResult == DialogResult.OK)
                {
                    Indexer = new RevitFamilyIndexer(CommandData);
                    var path = Assembly.GetExecutingAssembly().Location;
                    const string str = "CDWKS.RevitAddon.Indexer2012.dll";
                    var str1 = path.Substring(0, path.Length - str.Length);
                    var args = InstanceId.ToString() + " 2012";
                    var oProcess = Process.Start(str1 + "CDWKS.RevitAddOn.ProgressMonitor.exe", args);

                    while (oProcess != null && !oProcess.HasExited)
                    {
                        if (CanIndex())
                        {
                            IndexNext();
                        }
                    }
                }
            }

            return Result.Succeeded;
        }
Example #6
0
 public static bool CheckError(dynamic result)
 {
     if (!result.Success)
     {
         if (result.Code == ConsoleConst.ERROR_VALIDATE_TOKEN_CODE)
         {
             AppMessage.AlertErrMessage(ConsoleConst.ERROR_VALIDATE_TOKEN_MSG);
             var openForm = Application.OpenForms[0];
             openForm.Hide();
             var login = new LoginForm();
             var diaLog = login.ShowDialog();
             if (diaLog == DialogResult.OK)
             {
                 openForm.Show();
             }
             else
             {
                 Default defaultFrm = (Default)openForm;
                 defaultFrm.notifyApp.Visible = false;
                 Environment.Exit(0);
             }
         }
         else
         {
             AppMessage.AlertErrMessage(result.Message);
         }
         return false;
     }
     return true;
 }
        public CounterForm()
        {
            InitializeComponent();

            LoginForm form = new LoginForm();

            toolStripStatusLabel_UserName.Text = form.GetUserName();
            toolStripStatusLabel_UserType.Text = form.GetUserType();
            toolStripStatusLabel_Date.Text = DateTime.Today.ToLongDateString();

            ds = new DataSet();
            rentDAL = new Renting_Management_System.DAL.RentDAL();

            ds = rentDAL.GetAll();
            bindingSource = new BindingSource();
            bindingSource.DataSource = ds;
            bindingSource.DataMember = ds.Tables[0].TableName;
            bindingSource.Sort = ds.Tables[0].Columns[0].ColumnName + " ASC";
            dataGridView1.DataSource = bindingSource;
            bindingNavigator1.BindingSource = bindingSource;
            dataGridView1.Columns[0].ReadOnly = true;
            dataGridView1.Columns[1].ReadOnly = true;
            dataGridView1.Columns[2].ReadOnly = true;
            bindingNavigatorAddNewItem.Enabled = false;
            bindingNavigatorDeleteItem.Enabled = false;
            if (ds.HasChanges())
            {
                toolStripButton_Save.Enabled = true;
                changed = true;
            }
        }
Example #8
0
        public ActionResult Index(LoginForm form)
        {
            if (ModelState.IsValid)
            {
                if (this.IsLoginValid(form.Username, form.Password))
                {
                    UserPrincipalModel userModel = new UserPrincipalModel() { PersonId = form.Username == "student" ? 1 : 2 };
                    string json = JsonConvert.SerializeObject(userModel);

                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                             1,
                             form.Username,
                             DateTime.Now,
                             DateTime.Now.AddMonths(1),
                             true,
                             json);

                    string encTicket = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                    Response.Cookies.Add(faCookie);

                    return RedirectToAction("Index");
                }

                form.Error = "Wrong username/password combination";
            }

            return View("Index", form);
        }
Example #9
0
 private void LogoutLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     LoginForm login = new LoginForm();
     login.Location = this.Location;
     login.Show();
     this.Close();
 }
Example #10
0
 public void ShowDetail()
 {
     LoginForm loginForm = new LoginForm();
     Worktime.Text = "工作年月:" + loginForm.getCurWorkMonth();
     Date.Text = "日期:" + DBUtil.getServerTime().ToString("yyyy年MM月dd日");
     Opername.Text = "操作员:" + this.Username;
     RecordNum.Text = "查询结果:共有" + count + "条记录";
 }
 public Users Map(LoginForm form)
 {
     var user = new Users();
     user.Id = 0;
     user.MembName = form.MembName;
     user.Password = form.Password;
     user.Lastlogin = DateTime.Now;
     return user;
 }
Example #12
0
 public MainForm()
 {
     var loginForm = new LoginForm();
     var result = loginForm.ShowDialog();
     if (result != System.Windows.Forms.DialogResult.OK)
     {
         System.Environment.Exit(0);
     }
     InitializeComponent();
 }
        public StoreForm()
        {
            InitializeComponent();

            LoginForm form = new LoginForm();

            toolStripStatusLabel_UserName.Text = form.GetUserName();
            toolStripStatusLabel_UserType.Text = form.GetUserType();
            toolStripStatusLabel_Date.Text = DateTime.Now.ToShortDateString();
        }
Example #14
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            LoginForm loginForm = new LoginForm();

            loginForm.ShowDialog();
            if (loginForm.DialogResult == DialogResult.OK)
            {
                _user = new Steam.SteamUser(loginForm.Login, loginForm.Password);
                TempTextBox.Text = Steam.SteamWeb.Login(_user) ? "success" : "fail";
            }
        }
Example #15
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm login = new LoginForm();
            login.ShowDialog();

            if (login.DialogResult == DialogResult.OK)
            {
                Application.Run(new MainForm());
            }
        }
Example #16
0
 private void InitOecTerminal(OecTerminal terminal)
 {
     var f = new LoginForm();
     f.Owner = OwnerForm;
     f.Login = Config.OecLogin;
     f.Password = Config.OecPassword;
     f.ShowDialog();
     var username = f.Login;
     var password = f.Password;
     Config.OecLogin = username;
     Config.OecPassword = password;
     ConfigIntraday.Save("config.xml", Config); // TODO filename
     terminal.Login = username;
     terminal.Password = password;
     //terminal.Host = "127.0.0.1";
 }
		private void MainForm_Load(object sender, EventArgs e)
		{
			HideToTray();
			trayIcon.Text = "Authenticating...";
			var login = new LoginForm();
			login.LoginSuccesfull += login_LoginSuccesfull;

			// Kind of a weak way to do it, but if we cancel out of the login dialog, exit
			DialogResult loginResult = login.ShowDialog( this );

			if (loginResult == DialogResult.OK)
			{
				BeginWindowMonitoring();
			}
			else
				Close();
		}
Example #18
0
        static void Main()
        {
            bool run = true;

            #if !DEBUG
            // 二重起動を防止する
            using (Mutex mutex = new Mutex(false, Application.ProductName))
            {
                run = mutex.WaitOne(0, false);
            }
            #endif

            if (run)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var login = LoginInfo.Load();
                if (!login.IsExists())
                {
                    var frm = new LoginForm();
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        login = frm.LoginData;
                        LoginInfo.Save(login);
                    }
                }

                if (login.IsExists())
                {
                    var sw = new SessionWrapper(8892);
                    var database = new Database(sw);
                    Application.Run(new MainForm(database));
                }
            }
        }
Example #19
0
        public void ShowForm()
        {
            LoginForm f = new LoginForm();

            Application.Run(f);
        }
        public void LoginTest()
        {
            LoginForm l = new LoginForm();

            Assert.IsNotNull(l);
        }
Example #21
0
        // POST: api/User
        public Token Post([FromBody] LoginForm loginCredentials)
        {
            log.WriteLogEntry("Starting Post for login credentials...");
            Token result = null;

            if (loginCredentials.GetType() == typeof(LoginForm))
            {
                DomainUser user = new DomainUser
                {
                    UserName = loginCredentials.UserName,
                    UserPwd  = loginCredentials.UserPwd
                };
                try
                {
                    log.WriteLogEntry("Starting LoginHelper...");
                    LoginHelper loginHelp = new LoginHelper();
                    if (loginHelp.LoginDomainUser(user))
                    {
                        log.WriteLogEntry(string.Format("Result from LoginDomainUser {0} {1} {2}", user.UserName, user.DomainUpn, user.Authenicated));
                        log.WriteLogEntry("Starting UserHelper...");
                        UserHelper userHelp = new UserHelper(user);
                        if (userHelp.LoadDomainUser(user.UserID))
                        {
                            log.WriteLogEntry(string.Format("Result from LoadDomainUser {0} {1} {2} {3} {4} {5} {6}", user.UserName, user.DomainUpn, user.UserEmail, user.Company.CompanyName, user.Department.DeptName, user.Position.PostiionTitle, user.Authenicated));
                            log.WriteLogEntry("Starting LoginHelper...");
                            if (loginHelp.GetSessionToken(user))
                            {
                                // Insert internal domain user into local session database
                                log.WriteLogEntry("Starting LoginHelper...");
                                if (loginHelp.InsertDomainUserSession(user))
                                {
                                    result = user.Token;
                                    log.WriteLogEntry(string.Format("Current User {0} {1} {2} {3} {4}", user.UserName, user.UserEmail, user.UserID, user.Department.DeptName, user.Company.CompanyName));
                                }
                                else
                                {
                                    log.WriteLogEntry("FAILED inserting domain login user!");
                                }
                            }
                        }
                        else
                        {
                            log.WriteLogEntry("FAILED to load domain user!");
                        }
                    }
                    else
                    {
                        log.WriteLogEntry("FAILED authenticate domain credentials!");
                    }
                }
                catch (Exception ex)
                {
                    log.WriteLogEntry("Error posting login " + ex.Message);
                }
                log.WriteLogEntry(string.Format("Return result {0} {1} {2}", result.UserID, result.SessionKey, string.Join(",", user.Token.AccessKey)));
            }
            else
            {
                log.WriteLogEntry("Failed login credentials are the wrong type!");
            }
            log.WriteLogEntry("End Post login user.");

            // Return full session token
            return(result);
        }
Example #22
0
        private void QuickForm_Load(object sender, EventArgs e)
        {
            comboBoxEx1.SelectedIndex = 0;
            Global.notifyIcon = this.notifyIcon1;
            HookKeyPress.keyPressEvent += HookKeyPress_keyPressEvent;
            HookKeyPress.Hook_Start();
            nc.duiHuaEvent += nc_duiHuaEvent;
            nc.shiQuLianJieEvent += nc_shiQuLianJieEvent;
            nc.Start();
            try
            {
                actionf = new ActionFactory(this, nc);
                duihuacall = new WaitCallback(actionf.DoAction);

                LoginForm lf = new LoginForm(nc);
                DialogResult dr=lf.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    刷新所属游戏();
                    comboBoxEx3.SelectedIndex = 0;
                    ThreadPool.QueueUserWorkItem(new WaitCallback(BindData));
                }
                else
                {
                    System.Environment.Exit(System.Environment.ExitCode);
                }

            }
            catch (Exception ex)
            {
                ImportDataLog.WriteLog("ReceiveData:" + ex.Message + "\r\n" +
            "触发异常方法:" + ex.TargetSite + "\r\n" +
            "异常详细信息" + ex.StackTrace + "\r\n");
            }
        }
        /// <summary>
        /// Loads galaxy from server
        /// </summary>
        /// <param name="all">should get all maps</param>
        /// <param name="worker">should report to background worker</param>
        /// <param name="loadedGalaxy">use this galaxy state</param>
        public static void LoadGalaxy(bool all, BackgroundWorker worker, Galaxy loadedGalaxy)
        {
            if (all && worker == null)
            {
                throw new ApplicationException("All needs worker");
            }
            Directory.CreateDirectory(Program.CachePath);
            Directory.CreateDirectory(Program.MapInfoCache);
            Directory.CreateDirectory(Program.MetalmapCache);
            Directory.CreateDirectory(Program.HeightmapCache);
            Directory.CreateDirectory(Program.MinimapCache);
            GalaxyMap.Instance = null;
            if (worker != null)
            {
                worker.ReportProgress(0, new[] { "Connecting" });
            }
            bool done = Program.AuthInfo != null;

            do
            {
                if (!done)
                {
                    var loginForm = new LoginForm();
                    if (DialogResult.OK != loginForm.ShowDialog())
                    {
                        Application.Exit();
                    }
                    Program.AuthInfo = loginForm.AuthInfo;
                }
                Program.LastUpdate = DateTime.Now;

                GalaxyMap.Instance.Galaxy = loadedGalaxy ?? Program.Server.GetGalaxyMap(Program.AuthInfo);
                // either use loadedgalaxy or get new one
                done = GalaxyMap.Instance.Galaxy != null;
                if (!done)
                {
                    MessageBox.Show("Invalid username or password.");
                }
            } while (!done);
            var galaxyMap = GalaxyMap.Instance;
            var galaxy    = galaxyMap.Galaxy;

            galaxy.Planets.ForEach(p => galaxyMap.PlanetDrawings.Add(new PlanetDrawing(p)));

            var q = (from f in galaxy.Factions
                     from p in galaxy.GetAttackOptions(f)
                     select new { p.ID, f });

            galaxyMap.AttackablePlanetIDs = q.ToDictionary(t => t.ID, t => t.f);

            galaxyMap.ClaimablePlanetIDs = galaxy.GetClaimablePlanets().Select(p => p.ID).ToArray();

            var neededMaps = all
                                                ? galaxy.MapNames.Except(galaxyMap.Maps.Select(m => m.Name))
                                                : galaxy.Planets.Select(p => p.MapName).Where(n => n != null);
            var mapsToDownload = neededMaps.Where(n => !File.Exists(Program.MapInfoCache.Combine(n + ".dat"))).ToArray();

            int       maxProgress = mapsToDownload.Length * 4;
            WebClient Client      = new WebClient();
            int       progress    = 0;

            if (worker != null)
            {
                Action <string, string> MapReport =
                    (message, mapName) =>
                    worker.ReportProgress(progress++ *100 / maxProgress, new[] { message + Map.GetHumanName(mapName), mapName });
#if false
                foreach (var mapName in mapsToDownload)
                {
                    MapReport("Downloading Map Info", mapName);
                    Client.DownloadFile(Program.MapInfoUrl + "/" + mapName + ".dat", Program.MapInfoCache.Combine(mapName + ".dat"));


                    MapReport("Downloading Minimap", mapName);
                    Client.DownloadFile(Program.MinimapUrl + "/" + mapName + ".jpg", Program.MinimapCache.Combine(mapName + ".jpg"));
                    MapReport("Downloading Heightmap", mapName);
                    Client.DownloadFile(
                        Program.HeightmapUrl + "/" + mapName + ".jpg", Program.HeightmapCache.Combine(mapName + ".jpg"));
                    MapReport("Downloading Metalmap", mapName);
                    Client.DownloadFile(Program.MetalmapUrl + "/" + mapName + ".png", Program.MetalmapCache.Combine(mapName + ".png"));
                    worker.ReportProgress(progress * 100 / maxProgress, mapName);
                }
#endif
            }
        }
Example #24
0
 private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     loginForm = new LoginForm();
     loginForm.Show();
 }
 private bool Login(LoginForm model)
 {
     try
     {
         if (IsValidUser(model))
         {
             this.Logger.Info("RegistrationController.Login(UserProfile model)");
             CoatsUserProfile profile = CoatsUserProfile.GetProfile(model.EmailAddress);
             CookieHelper.WriteFormsCookie(profile.MAIL, profile.DISPLAYNAME, profile.NAME, profile.SURNAME, profile.LONG, profile.LAT, "");
             return true;
         }
         base.ModelState.AddModelError("LoginFailed", Helper.GetResource("LoginFailed"));
     }
     catch (Exception exception)
     {
         this.Logger.ErrorFormat("Registration exception - {0}", new object[] { exception });
         base.ModelState.AddModelError("LoginFailed", Helper.GetResource("LoginFailed"));
         return false;
     }
     return false;
 }
 public static bool IsValidUser(LoginForm model)
 {
     return Membership.ValidateUser(model.EmailAddress, model.Password);
 }
Example #27
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var loginForm = new LoginForm();

            loginForm.ShowDialog();
        }
Example #28
0
 private void FormProgram_Load(object sender, EventArgs e)
 {
     _login = new LoginForm();
     _login.ShowDialog();
 }
Example #29
0
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => {
                Isloaded        = true;
                LoginForm login = new LoginForm();
                if (p == null)
                {
                    return;
                }
                p.Hide();
                login.ShowDialog();
                if (login.DataContext == null)
                {
                    return;
                }
                var loginVM = login.DataContext as LoginVM;
                if (loginVM.IsLogin)
                {
                    p.Show();
                    idnvNOW = loginVM.UserName;
                    try
                    {
                        //cocn = layhinh(loginVM.UserName);
                    }
                    catch
                    {
                        //cocn = null;
                    }
                }
                else
                {
                    p.Close();
                }
            });

            TaiXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { TaiXeForm txf = new TaiXeForm();  p.Children.Add(txf); });
            ChuyenXeCommand      = new RelayCommand <Grid>((p) => { return(true); }, (p) => { ChuyenXeForm cxf = new ChuyenXeForm();; p.Children.Add(cxf); });
            TuyenXeCommand       = new RelayCommand <Grid>((p) => { return(true); }, (p) => { TuyenXeForm txf = new TuyenXeForm();; p.Children.Add(txf); });
            BaoCaoThongKeCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => { BaoCaoThongKeForm bctkf = new BaoCaoThongKeForm();; p.Children.Add(bctkf); });
            PhuXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { PhuXeForm pxf = new PhuXeForm();; p.Children.Add(pxf); });
            QuanLyXeCommand      = new RelayCommand <Grid>((p) => { return(true); }, (p) => { QuanLyXeForm qlxf = new QuanLyXeForm(); p.Children.Clear(); p.Children.Add(qlxf); });
            SapLichCommand       = new RelayCommand <Grid>((p) => { return(true); }, (p) => { SapLichForm slf = new SapLichForm(); p.Children.Add(slf); });
            BenXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { BenXeForm bxf = new BenXeForm();; p.Children.Add(bxf); });
            DatVeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCBooking uCBooking = new UCBooking();; p.Children.Add(uCBooking); });
            SaoLuuCommand        = new RelayCommand <Grid>((p) => { return(true); }, (p) => { SaoLuuForm slf = new SaoLuuForm();; p.Children.Add(slf); });
            NhanVienBanVeCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCNhanVienBanVe nvbvf = new UCNhanVienBanVe();; p.Children.Add(nvbvf); });

            ////
            ThongkeCommand  = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCThongKe thongke = new UCThongKe(); p.Children.Add(thongke); });
            testCommand     = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UserControl1 u1 = new UserControl1(); p.Children.Add(u1); });
            DangXuatCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoginForm lgf = new LoginForm(); lgf.ShowDialog(); });
            CloseCommand    = new RelayCommand <Window>((p) => { return(true); }, (p) => { p.Close(); });

            int i = 1;

            ChangeBackGroundCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => {
                int n = 6;
                if (i <= n)
                {
                    string uri1        = "pack://application:,,,/Img/h" + i + ".jpg";
                    ImageBrush myBrush = new ImageBrush();
                    try
                    {
                        myBrush.ImageSource = new BitmapImage(new Uri(uri1, UriKind.Absolute));
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    p.Background = myBrush;
                    i++; if (i == n)
                    {
                        i = 0;
                    }
                }
            });
        }
Example #30
0
        public LoginViewModel(   )
            
        { 
            Form = new LoginForm(){IsRememberPassword = true , IsUsernameEditAble = true };
#if DEBUG
            //return;
            Form.UserName = "******";
            
#endif
        }
 public void openRateFormFromLoginForm(LoginForm sender)
 {
     sender.Hide();
     rateForm = new RateForm(userController.getActualUser(), this);
     rateForm.Show();
 }
Example #32
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="login"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public async Task <User> LoginAsync(LoginForm login, Action <HttpException> action = null) =>
 await http.PostAsync <LoginForm, User>("auth/login", login, action);
 public SignalRSupport(string address, LoginForm loginWindow, LoginData loginData)
 {
 }
 public ActionResult EmailNewsletterSignup(EmailNewsletter emailNewsLetter)
 {
     Registration model = new Registration();
     LoginForm form = new LoginForm();
     RegistrationForm form2 = new RegistrationForm();
     model.RegistrationForm = form2;
     model.LoginForm = form;
     this.GetModelData(model.RegistrationForm);
     model.RegistrationForm.CraftTypeList = emailNewsLetter.Techniques;
     SelectListItem item = model.RegistrationForm.EmailNewsletter.SingleOrDefault<SelectListItem>(e => e.Text == "Yes");
     if (item != null)
     {
         item.Selected = true;
     }
     SelectListItem item2 = model.RegistrationForm.EmailNewsletter.SingleOrDefault<SelectListItem>(e => e.Text == "No");
     if (item2 != null)
     {
         item2.Selected = false;
     }
     model.RegistrationForm.CustomerDetails.EmailAddress = emailNewsLetter.EmailAddress;
     return base.View("Index", model);
 }
Example #35
0
        static void Main(string[] args)
        {
            LoginForm loginForm = new LoginForm();

            loginForm.ShowDialog();
        }
Example #36
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            LoginForm login = new LoginForm();

            login.ShowDialog();
        }
Example #37
0
 public LoginVM(LoginForm loginForm, MainWindow mainWindow)
 {
     _loginform  = loginForm;
     _mainWindow = mainWindow;
     log         = new LoginModel();
 }
Example #38
0
        public static void Login()
        {
            LoginForm f = new LoginForm();

            Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(null, f, false);
        }
Example #39
0
 private void LogInBtn_Click(object sender, EventArgs e)
 {
     CloseAllWindows();
     lform         = new LoginForm(this);
     lform.Visible = true;
 }
Example #40
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     timer.Stop();
     LoginForm.Show();
     Hide();
 }
 public LogInController()
 {
     View = new LoginForm();
     View.SetController(this);
 }
Example #42
0
 private void loginToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.BaseLink != String.Empty)
     {
         if (this.loginView == null)
         {
             this.loginView = new LoginForm();
             this.loginView.MdiParent = this;
             this.loginView.FormClosed += new FormClosedEventHandler(this.loginForm_FormClosed);
             this.loginView.Show();
         }
         else
         {
             this.allEventsForm.Activate();
         }
     }
     else
     {
         MessageBox.Show("Setup server IP first!", "Alert");
     }
 }
Example #43
0
        /// <summary>
        /// Do login.
        /// </summary>
        private void loginButton_Click(object sender, EventArgs e)
        {
            // Clean login form from a previous session
            if (_loginForm != null)
            {
                _loginForm.Dispose();
                _loginForm = null;
            }

            // Show login form
            _loginForm = new LoginForm();
            _loginForm.FirstForm = this;
            _loginForm.Show();
        }
Example #44
0
        public frmReg(LoginForm fLogin)
        {
            // TODO: Complete member initialization
            this.fLogin = fLogin;

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Name = "frmReg";
            this.Text = "Regester";
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmReg));
            this.label1 = new Label();
            this.txt_phone = new TextBox();
            this.label2 = new Label();
            this.txt_userName = new TextBox();
            this.label3 = new Label();
            this.txt_pwd1 = new TextBox();
            this.label4 = new Label();
            this.txt_pwd2 = new TextBox();
            this.label5 = new Label();
            this.txt_QQ = new TextBox();
            this.label6 = new Label();
            this.txt_WW = new TextBox();
            this.label7 = new Label();
            this.txt_tjr = new TextBox();
            this.button1 = new Button();
            this.label8 = new Label();
            this.txt_Msg = new TextBox();
            this.label9 = new Label();
            this.label10 = new Label();
            this.label12 = new Label();
            this.label11 = new Label();
            this.label13 = new Label();
            this.label14 = new Label();
            this.lab_phone = new Label();
            this.lab_userName = new Label();
            this.lab_pwd1 = new Label();
            this.lab_pwd2 = new Label();
            this.lab_QQ = new Label();
            this.lab_WW = new Label();
            this.lab_tjr = new Label();
            this.SuspendLayout();
            this.label1.AutoSize = true;
            this.label1.Location = new Point(6, 39);
            this.label1.Name = "label1";
            this.label1.Size = new Size(59, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "用 户 名:";
            this.txt_phone.Location = new Point(71, 6);
            this.txt_phone.MaxLength = 11;
            this.txt_phone.Name = "txt_phone";
            this.txt_phone.Size = new Size(148, 21);
            this.txt_phone.TabIndex = 1;
            // ISSUE: method pointer

            // ISSUE: method pointer
            this.txt_phone.Leave += new EventHandler(txt_phone_Leave);
            // ISSUE: method pointer
            this.txt_phone.KeyPress += new KeyPressEventHandler(txt_phone_KeyPress);
            this.label2.AutoSize = true;
            this.label2.Location = new Point(6, 9);
            this.label2.Name = "label2";
            this.label2.Size = new Size(59, 12);
            this.label2.TabIndex = 0;
            this.label2.Text = "手机号码:";
            this.txt_userName.Location = new Point(71, 36);
            this.txt_userName.MaxLength = 20;
            this.txt_userName.Name = "txt_userName";
            this.txt_userName.Size = new Size(148, 21);
            this.txt_userName.TabIndex = 2;
            // ISSUE: method pointer
            this.txt_userName.Leave += new EventHandler(txt_userName_Leave);
            // ISSUE: method pointer
            this.txt_userName.KeyPress += new KeyPressEventHandler(txt_userName_KeyPress);
            this.label3.AutoSize = true;
            this.label3.Location = new Point(6, 69);
            this.label3.Name = "label3";
            this.label3.Size = new Size(59, 12);
            this.label3.TabIndex = 0;
            this.label3.Text = "密    码:";
            this.txt_pwd1.Location = new Point(71, 66);
            this.txt_pwd1.MaxLength = 15;
            this.txt_pwd1.Name = "txt_pwd1";
            this.txt_pwd1.PasswordChar = '*';
            this.txt_pwd1.Size = new Size(148, 21);
            this.txt_pwd1.TabIndex = 3;
            // ISSUE: method pointer
            this.txt_pwd1.Leave += new EventHandler(txt_pwd1_Leave);
            this.label4.AutoSize = true;
            this.label4.Location = new Point(6, 129);
            this.label4.Name = "label4";
            this.label4.Size = new Size(59, 12);
            this.label4.TabIndex = 0;
            this.label4.Text = "Q Q 号码:";
            this.txt_pwd2.Location = new Point(71, 96);
            this.txt_pwd2.MaxLength = 15;
            this.txt_pwd2.Name = "txt_pwd2";
            this.txt_pwd2.PasswordChar = '*';
            this.txt_pwd2.Size = new Size(148, 21);
            this.txt_pwd2.TabIndex = 4;
            // ISSUE: method pointer
            this.txt_pwd2.Leave += new EventHandler(txt_pwd2_Leave);
            this.label5.AutoSize = true;
            this.label5.Location = new Point(6, 159);
            this.label5.Name = "label5";
            this.label5.Size = new Size(59, 12);
            this.label5.TabIndex = 0;
            this.label5.Text = "店铺旺旺:";
            this.txt_QQ.Location = new Point(71, 126);
            this.txt_QQ.MaxLength = 15;
            this.txt_QQ.Name = "txt_QQ";
            this.txt_QQ.Size = new Size(148, 21);
            this.txt_QQ.TabIndex = 5;
            // ISSUE: method pointer
            this.txt_QQ.Leave += new EventHandler(txt_QQ_Leave);
            // ISSUE: method pointer
            this.txt_QQ.KeyPress += new KeyPressEventHandler(txt_QQ_KeyPress);
            this.label6.AutoSize = true;
            this.label6.Location = new Point(6, 189);
            this.label6.Name = "label6";
            this.label6.Size = new Size(59, 12);
            this.label6.TabIndex = 0;
            this.label6.Text = "推荐人QQ:";
            this.txt_WW.Location = new Point(71, 156);
            this.txt_WW.MaxLength = 30;
            this.txt_WW.Name = "txt_WW";
            this.txt_WW.Size = new Size(148, 21);
            this.txt_WW.TabIndex = 6;
            // ISSUE: method pointer
            this.txt_WW.Leave += new EventHandler(txt_WW_Leave);
            // ISSUE: method pointer
            this.txt_WW.KeyPress += new KeyPressEventHandler(txt_WW_KeyPress);
            this.label7.AutoSize = true;
            this.label7.Location = new Point(6, 99);
            this.label7.Name = "label7";
            this.label7.Size = new Size(59, 12);
            this.label7.TabIndex = 0;
            this.label7.Text = "确认密码:";
            this.txt_tjr.Location = new Point(71, 186);
            this.txt_tjr.MaxLength = 20;
            this.txt_tjr.Name = "txt_tjr";
            this.txt_tjr.Size = new Size(148, 21);
            this.txt_tjr.TabIndex = 7;
            // ISSUE: method pointer
            this.txt_tjr.Leave += new EventHandler(txt_tjr_Leave);
            // ISSUE: method pointer
            this.txt_tjr.KeyPress += new KeyPressEventHandler(txt_tjr_KeyPress);
            this.button1.Location = new Point(121, 213);
            this.button1.Name = "button1";
            this.button1.Size = new Size(85, 32);
            this.button1.TabIndex = 8;
            this.button1.Text = "提交注册";
            this.button1.UseVisualStyleBackColor = true;
            // ISSUE: method pointer
            this.button1.Click += new EventHandler(button1_Click);
            this.label8.AutoSize = true;
            this.label8.ForeColor = Color.Red;
            this.label8.Location = new Point(221, 227);
            this.label8.Name = "label8";
            this.label8.Size = new Size(47, 12);
            this.label8.TabIndex = 3;
            this.label8.Text = "*为必填";
            this.txt_Msg.Location = new Point(8, 251);
            this.txt_Msg.Multiline = true;
            this.txt_Msg.Name = "txt_Msg";
            this.txt_Msg.Size = new Size(359, 69);
            this.txt_Msg.TabIndex = 10;
            // ISSUE: method pointer
            this.txt_Msg.KeyPress += new KeyPressEventHandler(txt_Msg_KeyPress);
            // ISSUE: method pointer
            this.txt_Msg.Enter += new EventHandler(txt_Msg_Enter);
            this.label9.AutoSize = true;
            this.label9.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label9.ForeColor = Color.Red;
            this.label9.Location = new Point(221, 9);
            this.label9.Name = "label9";
            this.label9.Size = new Size(11, 12);
            this.label9.TabIndex = 3;
            this.label9.Text = "*";
            this.label10.AutoSize = true;
            this.label10.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label10.ForeColor = Color.Red;
            this.label10.Location = new Point(221, 39);
            this.label10.Name = "label10";
            this.label10.Size = new Size(11, 12);
            this.label10.TabIndex = 3;
            this.label10.Text = "*";
            this.label12.AutoSize = true;
            this.label12.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label12.ForeColor = Color.Red;
            this.label12.Location = new Point(221, 69);
            this.label12.Name = "label12";
            this.label12.Size = new Size(11, 12);
            this.label12.TabIndex = 3;
            this.label12.Text = "*";
            this.label11.AutoSize = true;
            this.label11.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label11.ForeColor = Color.Red;
            this.label11.Location = new Point(221, 99);
            this.label11.Name = "label11";
            this.label11.Size = new Size(11, 12);
            this.label11.TabIndex = 3;
            this.label11.Text = "*";
            this.label13.AutoSize = true;
            this.label13.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label13.ForeColor = Color.Red;
            this.label13.Location = new Point(221, 129);
            this.label13.Name = "label13";
            this.label13.Size = new Size(11, 12);
            this.label13.TabIndex = 3;
            this.label13.Text = "*";
            this.label14.AutoSize = true;
            this.label14.Font = new Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte)134);
            this.label14.ForeColor = Color.Red;
            this.label14.Location = new Point(221, 159);
            this.label14.Name = "label14";
            this.label14.Size = new Size(11, 12);
            this.label14.TabIndex = 3;
            this.label14.Text = "*";
            this.lab_phone.AutoSize = true;
            this.lab_phone.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_phone.Location = new Point(236, 9);
            this.lab_phone.Name = "lab_phone";
            this.lab_phone.Size = new Size(137, 12);
            this.lab_phone.TabIndex = 0;
            this.lab_phone.Text = "可以联系到您的手机号码";
            this.lab_userName.AutoSize = true;
            this.lab_userName.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_userName.Location = new Point(236, 39);
            this.lab_userName.Name = "lab_userName";
            this.lab_userName.Size = new Size(131, 12);
            this.lab_userName.TabIndex = 0;
            this.lab_userName.Text = "3位以上英文字母或数字";
            this.lab_pwd1.AutoSize = true;
            this.lab_pwd1.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_pwd1.Location = new Point(236, 69);
            this.lab_pwd1.Name = "lab_pwd1";
            this.lab_pwd1.Size = new Size(107, 12);
            this.lab_pwd1.TabIndex = 0;
            this.lab_pwd1.Text = "3-15位,区分大小写";
            this.lab_pwd2.AutoSize = true;
            this.lab_pwd2.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_pwd2.Location = new Point(236, 99);
            this.lab_pwd2.Name = "lab_pwd2";
            this.lab_pwd2.Size = new Size(77, 12);
            this.lab_pwd2.TabIndex = 0;
            this.lab_pwd2.Text = "再次输入密码";
            this.lab_QQ.AutoSize = true;
            this.lab_QQ.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_QQ.Location = new Point(236, 129);
            this.lab_QQ.Name = "lab_QQ";
            this.lab_QQ.Size = new Size(113, 12);
            this.lab_QQ.TabIndex = 0;
            this.lab_QQ.Text = "可以联系到您QQ号码";
            this.lab_WW.AutoSize = true;
            this.lab_WW.ForeColor = Color.FromArgb(64, 64, 64);
            this.lab_WW.Location = new Point(236, 159);
            this.lab_WW.Name = "lab_WW";
            this.lab_WW.Size = new Size(113, 12);
            this.lab_WW.TabIndex = 0;
            this.lab_WW.Text = "您的店铺的旺旺号码";
            this.lab_tjr.AutoSize = true;
            this.lab_tjr.ForeColor = Color.Red;
            this.lab_tjr.Location = new Point(224, 189);
            this.lab_tjr.Name = "lab_tjr";
            this.lab_tjr.Size = new Size(143, 12);
            this.lab_tjr.TabIndex = 0;
            this.lab_tjr.Text = "推荐人将可获得888流量币";
            this.AutoScaleDimensions = new SizeF(6f, 12f);
            this.AutoScaleMode = AutoScaleMode.Font;
            this.ClientSize = new Size(376, 324);
            this.Controls.Add((Control)this.label14);
            this.Controls.Add((Control)this.label13);
            this.Controls.Add((Control)this.label11);
            this.Controls.Add((Control)this.txt_Msg);
            this.Controls.Add((Control)this.label12);
            this.Controls.Add((Control)this.label10);
            this.Controls.Add((Control)this.label9);
            this.Controls.Add((Control)this.label8);
            this.Controls.Add((Control)this.button1);
            this.Controls.Add((Control)this.txt_tjr);
            this.Controls.Add((Control)this.label7);
            this.Controls.Add((Control)this.txt_WW);
            this.Controls.Add((Control)this.label6);
            this.Controls.Add((Control)this.txt_QQ);
            this.Controls.Add((Control)this.label5);
            this.Controls.Add((Control)this.txt_pwd2);
            this.Controls.Add((Control)this.label4);
            this.Controls.Add((Control)this.txt_pwd1);
            this.Controls.Add((Control)this.label3);
            this.Controls.Add((Control)this.txt_userName);
            this.Controls.Add((Control)this.lab_tjr);
            this.Controls.Add((Control)this.lab_WW);
            this.Controls.Add((Control)this.lab_QQ);
            this.Controls.Add((Control)this.lab_pwd2);
            this.Controls.Add((Control)this.lab_pwd1);
            this.Controls.Add((Control)this.lab_userName);
            this.Controls.Add((Control)this.lab_phone);
            this.Controls.Add((Control)this.label2);
            this.Controls.Add((Control)this.txt_phone);
            this.Controls.Add((Control)this.label1);
            this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
            this.MaximizeBox = false;
            this.Name = "frmReg";
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "新用户注册";
            // ISSUE: method pointer
            this.Load += new EventHandler(frmReg_Load);
            this.ResumeLayout(false);
            InitializeComponent();
        }
Example #45
0
        public async Task <IActionResult> Token(LoginForm loginForm)
        {
            if (loginForm.Grant_Type == "password")
            {
                if (!string.IsNullOrWhiteSpace(loginForm.Username))
                {
                    var username = _context.Students.Where(s => s.Username == loginForm.Username).FirstOrDefault()?.Username;
                    if (username == null)
                    {
                        return(Unauthorized(new { error = "Incorrect username." }));
                    }
                    var user = await _userManager.FindByNameAsync(username);

                    Microsoft.AspNetCore.Identity.SignInResult password_check =
                        await _signInManager.CheckPasswordSignInAsync(user, loginForm.Password, false);

                    if (!password_check.Succeeded)
                    {
                        return(Unauthorized(new { error = "Incorrect password." }));
                    }
                    _refreshTokenManager.RemoveByUsername(username);
                    var claims = new[]
                    {
                        new Claim("Username", username)
                    };
                    var secretBytes = Encoding.UTF8.GetBytes(Constants.Secret);
                    var key         = new SymmetricSecurityKey(secretBytes);
                    var algorithm   = SecurityAlgorithms.HmacSha256;

                    var signingCredentials = new SigningCredentials(key, algorithm);
                    var now   = DateTime.Now;
                    var token = new JwtSecurityToken(
                        Constants.Issuer,
                        Constants.Audiance,
                        claims,
                        notBefore: now,
                        expires: now.AddMinutes(5),
                        signingCredentials);

                    var access_token  = new JwtSecurityTokenHandler().WriteToken(token);
                    var refresh_token = GenerateRefreshTokenString();
                    _refreshTokenManager.Add(new RefreshToken(username, refresh_token, now.AddHours(1)));
                    return(Ok(new { current_time = now, access_token, access_token_expires = now.AddMinutes(5), refresh_token, refresh_token_expires = now.AddHours(1) }));
                }
                return(Unauthorized(new { error = "Missing username." }));
            }
            if (loginForm.Grant_Type == "refresh_token")
            {
                if (string.IsNullOrWhiteSpace(loginForm.Refresh_Token))
                {
                    return(Unauthorized(new { error = "Missing refresh token." }));
                }
                try
                {
                    var _refresh_token = _refreshTokenManager.Get(loginForm.Refresh_Token);
                    if (_refresh_token == null)
                    {
                        return(Unauthorized(new { error = "Invalid refresh token." }));
                    }
                    var now = DateTime.Now;
                    //if refresh token expired
                    if (_refresh_token.ExpiresAt < now)
                    {
                        return(Unauthorized(new { error = "Expired refresh token." }));
                    }
                    //generate access token, remove old and generate new refresh token
                    _refreshTokenManager.Remove(_refresh_token);
                    var claims = new[]
                    {
                        new Claim("Username", _refresh_token.Username)
                    };
                    var secretBytes = Encoding.UTF8.GetBytes(Constants.Secret);
                    var key         = new SymmetricSecurityKey(secretBytes);
                    var algorithm   = SecurityAlgorithms.HmacSha256;

                    var signingCredentials = new SigningCredentials(key, algorithm);
                    var token = new JwtSecurityToken(
                        Constants.Issuer,
                        Constants.Audiance,
                        claims,
                        notBefore: now,
                        expires: now.AddMinutes(5),
                        signingCredentials);

                    var access_token  = new JwtSecurityTokenHandler().WriteToken(token);
                    var refresh_token = GenerateRefreshTokenString();
                    _refreshTokenManager.Add(new RefreshToken(_refresh_token.Username, refresh_token, now.AddHours(1)));
                    return(Ok(new { current_time = now, access_token, access_token_expires = now.AddMinutes(5), refresh_token, refresh_token_expires = now.AddHours(1) }));
                }
                catch (SecurityTokenException e)
                {
                    return(Unauthorized(new { error = e.Message }));
                }
            }
            return(Unauthorized($"Invalid 'grant_type':'{loginForm.Grant_Type}'"));
        }
Example #46
0
        static public void MOGGlobalLaunchProjectLogin(string projectName, bool forceLogin)
        {
            // Launch the login dialog
            LoginForm login = new LoginForm(projectName);

            mainForm.Enabled = false;

Login:
            // Show the dialog
            if (login.ShowDialog(mainForm) == DialogResult.OK)
            {
                try
                {
                    // Login to the specified Project
                    if (guiProject.SetLoginProject(login.LoginProjectsComboBox.Text, login.LoginBranchesComboBox.Text))
                    {
                        // Set the login user
                        guiUser guiUsers = new guiUser(mainForm);
                        if ((string.Compare(login.LoginUsersComboBox.Text, "Choose Valid User", true) == 0) || (login.LoginUsersComboBox.Text.Length == 0))
                        {
                            MessageBox.Show("A valid user must be selected!", "Missing User");
                            goto Login;
                        }

                        if (guiUsers.SetLoginUser(login.LoginUsersComboBox.Text))
                        {
                            mainForm.Enabled = true;

                            // Disable the Change SQL Server menu item if the logged in user is not an administrator
                            MOGGlobalSetSQLConnectionMenuItemEnabled(login.LoginUsersComboBox.Text);
                            // Disable the Configure Project menu item if the logged in user is not an administrator
                            MOGGlobalSetToolsConfigureProjectMenuItemEnabled(login.LoginUsersComboBox.Text);
                            // Disable the Set MOG Repository menu item if the logged in user is not an administrator
                            MOGGlobalSetFileMOGRepositoryMenuItemEnabled(login.LoginUsersComboBox.Text);
                        }
                        else
                        {
                            MessageBox.Show("A valid user must be selected!", "Login Error");
                            goto Login;
                        }
                    }
                    else
                    {
                        MessageBox.Show("A valid project and branch must be selected!", "Login Error");
                        goto Login;
                    }
                }
                catch (Exception e)
                {
                    MOG_Report.ReportMessage("Login Project", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
                    goto Login;
                }
            }
            else if (login.DialogResult == DialogResult.Cancel && forceLogin)
            {
                if (MessageBox.Show(mainForm, "Do you wish to exit MOG?", "Exit?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    mainForm.Close();
                    mainForm.Shutdown();
                }
                else
                {
                    goto Login;
                }
            }
            else
            {
                if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser())
                {
                    MessageBox.Show("A valid project and user must be selected!", "Missing Project or User");
                    goto Login;
                }

                mainForm.Enabled = true;
            }

            // Always initialize our Database before leaving because the dialog loads projects that will leave us in a dirty state
            MOG_ControllerSystem.InitializeDatabase("", MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName());
        }
Example #47
0
 public LoginController(LoginForm view)
 {
     this.view = view;
     model     = new LoginModel();
 }
Example #48
0
 public FormController(LoginForm log)
 {
    OrderController.CreateOrdersTable();
    OrderController.GetOrders();
    loginForm = log;      }
Example #49
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            LoginForm form = new LoginForm();

            form.Show();
        }
Example #50
0
        public void Start(bool interactive)
        {
            if (!PuttyTunnelManagerSettings.Instance().HasPlink)
            {
                throw new PlinkNotFoundException();
            }

            this.active = true;
            Session.OpenSessions.Add(this.session);

            this.guardian.Start();
            Debug.WriteLine("Plink: Starting Guardian!");

            if (interactive)
            {
                this.process.StartInfo.RedirectStandardOutput = true;
                this.process.StartInfo.RedirectStandardInput  = true;
            }

            StringBuilder args = new StringBuilder("-agent -N -load \"" + this.session.Name + "\"");

            if (this.session.UsePtmForTunnels)
            {
                foreach (Tunnel tunnel in this.session.Tunnels)
                {
                    switch (tunnel.Type)
                    {
                    case TunnelType.LOCAL:
                        args.Append(" -L " + tunnel.LongConnectionString);
                        break;

                    case TunnelType.REMOTE:
                        args.Append(" -R " + tunnel.LongConnectionString);
                        break;

                    case TunnelType.DYNAMIC:
                        args.Append(" -D " + tunnel.ShortConnectionString);
                        break;
                    }
                }
            }

            this.process.StartInfo.Arguments = args.ToString();
            this.process.Start();
            Debug.WriteLine("Plink: Started!");

            if (interactive)
            {
                this.process.StandardInput.AutoFlush = true;

                StringBuilder buffer   = new StringBuilder();
                string        username = this.session.Username;
                while (!this.process.HasExited)
                {
                    while (this.process.StandardOutput.Peek() > 0)
                    {
                        char c = (char)this.process.StandardOutput.Read();
                        buffer.Append(c);
                    }

                    string data = buffer.ToString().ToLower();

                    if (data.Contains("login"))
                    {
                        LoginForm form = new LoginForm();
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            username = form.Username;
                            if (form.SaveUsername)
                            {
                                session.Username = username;
                                session.Serialize();
                            }
                            this.process.StandardInput.WriteLine(username);
                        }
                        else
                        {
                            Stop();
                        }
                    }
                    else if (data.Contains("password"))
                    {
                        LoginForm form = new LoginForm(username);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            this.process.StandardInput.WriteLine(form.Password);
                        }
                        else
                        {
                            Stop();
                        }
                    }
                    this.process.StandardOutput.DiscardBufferedData();
                    buffer.Remove(0, buffer.Length);
                }
            }
            else
            {
                this.process.WaitForExit();
            }

            Debug.WriteLine("Plink: Stopped!");

            Session.OpenSessions.Remove(this.session);
            this.active = false;
        }
Example #51
0
        public void Initialise()
        {
            Log.log("Creating Controls..");
            Log.log("Loading LoginForm");
            _loginForm = new LoginForm("frmLogin");
            Log.log("Loading DockModule");
            dockModule = new DockModule("dock");
            Log.log("Loading Layout");
            panelLayout = new PanelLayout("pnlLayout");
            Log.log("Loading Console");
            ConsoleModule = new ConsoleModule("console");
            Log.log("Loading Chat");
            chatModule = new ChatModule("chat");
            Log.log("Loading Item Tree");
            itemTreeModule = new ItemTreeModule("items");

            Check();
        }
Example #52
0
        public void APIStateChanged(APIAccess api, APIState state)
        {
            form = null;

            switch (state)
            {
            case APIState.Offline:
                Children = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Text   = "ACCOUNT",
                        Margin = new MarginPadding {
                            Bottom = 5
                        },
                        Font = @"Exo2.0-Black",
                    },
                    form = new LoginForm()
                };
                break;

            case APIState.Failing:
                Children = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Text = "Connection failing :(",
                    },
                };
                break;

            case APIState.Connecting:
                Children = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Text   = "Connecting...",
                        Margin = new MarginPadding {
                            Top = 10, Bottom = 10
                        },
                    },
                };
                break;

            case APIState.Online:
                Children = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Padding          = new MarginPadding {
                            Left = 20, Right = 20
                        },
                        Direction = FillDirection.Vertical,
                        Spacing   = new Vector2(0f, 10f),
                        Children  = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Children         = new[]
                                {
                                    new OsuSpriteText
                                    {
                                        Anchor   = Anchor.Centre,
                                        Origin   = Anchor.Centre,
                                        Text     = "Signed in",
                                        TextSize = 18,
                                        Font     = @"Exo2.0-Bold",
                                        Margin   = new MarginPadding {
                                            Top = 5, Bottom = 5
                                        },
                                    },
                                },
                            },
                            panel = new UserPanel(api.LocalUser.Value)
                            {
                                RelativeSizeAxes = Axes.X
                            },
                            dropdown = new UserDropdown {
                                RelativeSizeAxes = Axes.X
                            },
                        },
                    },
                };

                panel.Status.BindTo(api.LocalUser.Value.Status);

                dropdown.Current.ValueChanged += newValue =>
                {
                    switch (newValue)
                    {
                    case UserAction.Online:
                        api.LocalUser.Value.Status.Value = new UserStatusOnline();
                        dropdown.StatusColour            = colours.Green;
                        break;

                    case UserAction.DoNotDisturb:
                        api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb();
                        dropdown.StatusColour            = colours.Red;
                        break;

                    case UserAction.AppearOffline:
                        api.LocalUser.Value.Status.Value = new UserStatusOffline();
                        dropdown.StatusColour            = colours.Gray7;
                        break;

                    case UserAction.SignOut:
                        api.Logout();
                        break;
                    }
                };
                dropdown.Current.TriggerChange();

                break;
            }

            if (form != null)
            {
                inputManager.ChangeFocus(form);
            }
        }
Example #53
0
 private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LoginForm lf = new LoginForm();
     lf.Show();
     this.Close();
 }
Example #54
0
 public void Create([FromBody] LoginForm loginForm)
 {
     _userService.CheckCredentials(loginForm);
 }
 public ActionResult Login(LoginForm form)
 {
     return Handle(form).Return(() => Redirect<ShipyardController>(x => x.Index()));
 }
Example #56
0
        private void pbInfinityChess_Click(object sender, EventArgs e)
        {
            LoginForm loginForm = new LoginForm();

            loginForm.ShowDialog(this);
        }
Example #57
0
 public LoginPresenter(LoginForm view) : base(view)
 {
     LoginForm.LogButton.Click += onLoginClick;
 }
Example #58
0
        private void button2_Click(object sender, EventArgs e)
        {
            LoginForm objLoginForm = new LoginForm();

            objLoginForm.Show();
        }
Example #59
0
 private void loginForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.loginView = null;
 }
 public RegistrationForm(LoginForm login)
 {
     InitializeComponent();
     Login = login;
 }