示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose;
                _container = _containerBuilder.Build();

                var mainWidow = new MainWindow {DataContext = _container.Resolve<IMainViewModel>()};
                MainWindow = mainWidow;
                mainWidow.Show();
                base.OnStartup(e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
        private void OnClickLoginBtn(object sender, RoutedEventArgs e)
        {
            usernameBox.BorderBrush = Brushes.Gray;
            passwordBox.BorderBrush = Brushes.Gray;
            string usernameOrEmail = usernameBox.Text;
            string password = passwordBox.Password;
            bool allSet = true;

            if (usernameOrEmail == "")
            {
                usernameBox.BorderBrush = Brushes.Red;
                allSet = false;
            }

            if (password == "")
            {
                passwordBox.BorderBrush = Brushes.Red;
                allSet = false;
            }

            if (allSet)
            {
                string ret = LoginForm.DoPost(usernameOrEmail, password);
                if (!ret.StartsWith("contact"))
                {
                    MessageBox.Show(ret, "Error");
                }
                else
                {
                    this.Visibility = System.Windows.Visibility.Hidden;
                    MainWindow mainWindow = new MainWindow(ret);
                    mainWindow.ShowDialog();
                    mainWindow.Focus();
                    this.Close();
                }
            }
        }
示例#3
0
 public NewContactForm(MainWindow homeFormParamter)
 {
     InitializeComponent();//Basically illustrates the form
     home = homeFormParamter;
 }