コード例 #1
0
        public AccountListControl(AccountControl accountControl, List<Account> accounts)
        {
            // Some variables
            this.accounts = accounts;
            this.accountControl = accountControl;
            this.VisibleChanged += (o, e) => { if (this.Visible) this.fillAccounts(); };

            // The controls
            this.tbFilter = new Tb(this);
            this.lbAccounts = new Lb(this);
            this.lbAccounts.MouseDoubleClick += (o, e) => { this.ViewAccount(); };

            // Add standard buttons
            this.btnCreate = new Btn("Create new", this);
            this.btnCreate.Click += (o, e) => { this.CreateAccount(); };
            this.btnView = new Btn("View", this);
            this.btnView.Click += (o, e) => { this.ViewAccount(); };
            this.btnDelete = new Btn("Delete", this);
            this.btnDelete.Click += (o, e) => { this.DeleteAccount(); };
            this.btnSettings = new Btn("Settings", this);
            this.btnSettings.Click += (o, e) => { this.ShowUserControl<SettingsControl>(); };
        }
コード例 #2
0
        public SettingsControl()
        {
            // Some basic settings
            this.Hide();

            // Add settings
            this.tbFileLocation = new Tb(this);
            this.btnBrowseFileLocation = new Btn("Browse", this);
            this.btnBrowseFileLocation.Click += this.browseFileLocation;
            this.tbDefaultEmail = new Tb(this);

            // Add buttons
            this.btnResetDefaults = new Btn("Reset defaults", this);
            this.btnResetDefaults.Size = new Size(this.btnResetDefaults.Width + 25, this.btnResetDefaults.Height);
            this.btnResetDefaults.Click += (o, e) => { this.setDefaults(); };
            this.btnOk = new Btn("Ok", this);
            this.btnOk.Click += (o, e) => { this.save(true); };
            this.btnCancel = new Btn("Cancel", this);
            this.btnCancel.Click += (o, e) => { this.closeControl(); };

            // Load the settings
            this.VisibleChanged += (o, e) => { if (this.Visible) this.load(); };
        }