コード例 #1
0
        public SettingWindow(RegisterDocumentDataService registerService, ReviewInfoDataService reviewInfoService)
        {
            InitializeComponent();

            this.registerService   = registerService;
            this.reviewInfoService = reviewInfoService;

            this.registerService.ImportComplete   += EnableImportRegisterDataButton;
            this.reviewInfoService.ImportComplete += EnableImportReviewDataButton;

            settingLanguage.ItemsSource       = new BindingSource(AppConfig.Languages, null);
            settingLanguage.DisplayMemberPath = "Value";
            settingLanguage.SelectedValuePath = "Key";

            settingDbType.ItemsSource       = new BindingSource(AppConfig.StorageOptions, null);
            settingDbType.DisplayMemberPath = "Value";
            settingDbType.SelectedValuePath = "Key";

            registerService.RegisterDocumentImported += LogRegisterImportedData;
            registerService.RegisterDocumentImported += UpdateDataCount;
            reviewInfoService.ReviewInfoImported     += LogReviewImportedData;
            reviewInfoService.ReviewInfoImported     += UpdateDataCount;

            try
            {
                LoadLanguage();

                LoadSettings();

                UpdateDataCount();
            }
            catch (Exception ex)
            {
                ex.Log().Display();
                return;
            }
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                daoService = new SQLiteDaoService(Properties.Settings.Default.sqlite_db_location);
                // open db connection before doing anything else
                daoService.Open();

                registerDocumentDataService              = new RegisterDocumentDataService(daoService as IRegisterDocumentDao);
                registerDocumentPresenter                = new RegisterDocumentPresenter(this, registerDocumentDataService);
                registerDocumentDetailView               = new RegisterDocumentDetailView(this);
                registerDataGridView.CanUserAddRows      = false;
                registerDataGridView.AutoGenerateColumns = false;

                reviewInfoDataService = new ReviewInfoDataService(daoService as IReviewInfoDao);
                reviewInfoPresenter   = new ReviewInfoPresenter(this, reviewInfoDataService, registerDocumentDataService);
                reviewDataGridView.AutoGenerateColumns = false;
                reviewDataGridView.CanUserAddRows      = false;

                reviewFilesBS            = new BindingSource();
                reviewFilesBS.DataSource = new List <RegisterFile>();
                reviewFilesBS.AllowNew   = false;
                reviewFileDataGrid.AutoGenerateColumns = false;
                reviewFileDataGrid.ItemsSource         = reviewFilesBS;

                fileManagerBS            = new BindingSource();
                fileManagerBS.DataSource = new List <RegisterFile>();
                fileManagerBS.AllowNew   = false;
                fileManagerDataGridView.AutoGenerateColumns = false;
                fileManagerDataGridView.ItemsSource         = fileManagerBS;

                srchHistory.ItemsSource       = new BindingSource(AppConfig.RegisterHistoryOptions, null);
                srchHistory.DisplayMemberPath = "Value";
                srchHistory.SelectedValuePath = "Key";
                srchHistory.SelectedValue     = AppConfig.HISTORY_LATEST;

                settingForm = new SettingWindow(
                    registerDocumentDataService,
                    reviewInfoDataService);

                // adding sqlite module to setting form
                settingForm.SQLiteDaoService = daoService as SQLiteDaoService;

                settingForm.SettingChanged += LoadSearchOptions;
                settingForm.SettingChanged += LoadPictureViewer;
                settingForm.SettingChanged += LoadLanguage;

                LoadLanguage();

                // load search options
                LoadSearchOptions();

                // request docs list
                ShowRegisterList();

                // load picture viewer
                LoadPictureViewer();
            }
            catch (Exception ex)
            {
                throw ex.Log().Display();
            }
        }