Example #1
0
        public AppView(IUserService userService)
        {
            UserService = userService;
            InitializeComponent();

            excelService          = new ExcelService();
            db                    = MainFormService.Db;
            this.loginName.Text   = MainFormService.AppUser.Name;
            this.btnLogout.Click += (sender, e) =>
            {
                MainFormService.LogoutUser();
                MainFormService.ShowLoginView();
            };
            this.Disposed += (sender, args) => db.Dispose();

            this.tabControlAirplanes.Selected += async(sender, args) => await ShowTab(args.TabPage);

            this.btnDeleteTraffic.Click += async(s, a) => await DeleteTraffic();

            this.Load += async(s, a) => await ShowTab(this.tabControlAirplanes.SelectedTab);

            this.Load += (s, a) => CbxQueriesFill();

            btnXls.Click += async(s, a) => await ExportXls();

            btnGrUsersRefresh.Click += async(s, a) => await RefreshGridUsers();

            cbxPageNum.SelectedIndexChanged += async(s, a) => await RefreshGridUsers();

            cbxRowsPerPage.SelectedIndexChanged += (s, a) => {
                GetUserCount(async userCounts => {
                    UpdateUserGridPages(GetRowsPerPageSelected(), userCounts);
                    cbxPageNum.SelectedIndex = 0;
                    await RefreshGridUsers();
                });
            };

            btnGrAddFakeUsers.Click += (s, a) => AddFakeUsers();
            btnExportCSV.Click      += (s, a) => ExportUsersToCsvFile();

            InitGridUsers();
        }