Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            _filesForm = new FilesForm();
            _filesForm.FileSelectionChanged += _filesForm_FileSelectionChanged;
            _filesForm.Show(dockPanel1);

            _explorer = new FolderExplorer();
            _explorer.FolderLocationChanged += explorer_FolderLocationChanged;
            _explorer.Show(dockPanel1, DockState.DockLeft);

            _errors = new ErrorsForm();
            _errors.Show(dockPanel1, DockState.DockBottom);

            _descriptionForm = new DescriptionForm();
            _descriptionForm.Show(dockPanel1, DockState.DockRight);

            var dirToOpen = Settings.Default.LastViewedDirectory;

            if (String.IsNullOrEmpty(dirToOpen))
            {
                dirToOpen = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            OpenDirectory(dirToOpen);
            Descriptors = new List <IDescriptor>();
            LoadDescriptors();
        }
Exemplo n.º 2
0
        private void backEditButton_Click(object sender, EventArgs e)
        {
            Hide();
            FilesForm filesForm = new FilesForm(Username, Password);

            filesForm.Show();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            this.Hide();
            FilesForm mainForm = new FilesForm();

            mainForm.Show();
        }
Exemplo n.º 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            int userId = 0;

            if (checkBox1.Checked)
            {
                //if the admin exits in the database
                //show admin page
                int adminId = RepositoryUser.CheckAdmin(usernameTextBox.Text, true);

                if (adminId != 0)
                {
                    AdminForm adminForm = new AdminForm();
                    adminForm.Show();
                }
                else
                {
                    loginLabel.Text      = "Unrecognized admin. Please try again!";
                    loginLabel.TextAlign = ContentAlignment.MiddleCenter;
                    loginLabel.ForeColor = System.Drawing.Color.Red;
                    loginLabel.Show();
                    usernameTextBox.Text = "";
                    passwordTextBox.Text = "";
                    checkBox1.Checked    = false;
                }
            }
            else
            {
                //with false
                // show a normal user form
                userId = UserService.LoginUser(usernameTextBox.Text, passwordTextBox.Text);
                if (userId != 0)
                {
                    FilesForm formFiles = new FilesForm(usernameTextBox.Text, passwordTextBox.Text);
                    Hide();
                    formFiles.Show();
                }
                else
                {
                    loginLabel.Text      = "Your credentials are incorrect. Please try again";
                    loginLabel.ForeColor = System.Drawing.Color.Red;
                    usernameTextBox.Text = "";
                    passwordTextBox.Text = "";
                }
            }
        }