Example #1
0
        /// <summary>
        /// <see cref="CsvComparisonWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedBookId">選択された帳簿ID</param>
        public CsvComparisonWindow(DaoBuilder builder, int?selectedBookId)
        {
            this.builder        = builder;
            this.selectedBookId = selectedBookId;

            this.InitializeComponent();
            this.LoadWindowSetting();
        }
        /// <summary>
        /// 帳簿項目(移動)の新規登録のために <see cref="MoveRegistrationWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedBookId">帳簿ID</param>
        /// <param name="selectedMonth">選択された年月</param>
        /// <param name="selectedDate">選択された日付</param>
        public MoveRegistrationWindow(DaoBuilder builder, int?selectedBookId, DateTime?selectedMonth, DateTime?selectedDate)
        {
            this.builder        = builder;
            this.selectedBookId = selectedBookId;
            this.selectedMonth  = selectedMonth;
            this.selectedDate   = selectedDate;
            this.groupId        = null;

            this.InitializeComponent();
            this.LoadWindowSetting();

            this.WVM.RegMode = RegistrationMode.Add;
        }
Example #3
0
        /// <summary>
        /// 複数の帳簿項目の新規登録のために <see cref="ActionListRegistrationWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedBookId">選択された帳簿ID</param>
        /// <param name="selectedRecordList">選択されたCSVレコードリスト</param>
        public ActionListRegistrationWindow(DaoBuilder builder, int selectedBookId, List <CsvComparisonViewModel.CsvRecord> selectedRecordList)
        {
            this.builder            = builder;
            this.selectedBookId     = selectedBookId;
            this.selectedRecordList = selectedRecordList;
            this.selectedMonth      = null;
            this.selectedDate       = null;
            this.selectedGroupId    = null;

            this.InitializeComponent();
            this.LoadWindowSetting();

            this.WVM.RegMode = RegistrationMode.Add;
        }
Example #4
0
        /// <summary>
        /// 帳簿項目の新規登録のために <see cref="ActionRegistrationWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedBookId">選択された帳簿ID</param>
        /// <param name="selectedRecord">選択されたCSVレコード</param>
        public ActionRegistrationWindow(DaoBuilder builder, int selectedBookId, CsvComparisonViewModel.CsvRecord selectedRecord)
        {
            this.builder          = builder;
            this.selectedBookId   = selectedBookId;
            this.selectedMonth    = null;
            this.selectedDate     = null;
            this.selectedRecord   = selectedRecord;
            this.selectedActionId = null;

            this.InitializeComponent();
            this.LoadWindowSetting();

            this.WVM.RegMode = RegistrationMode.Add;
            this.WVM.AddedByCsvComparison = true;
        }
Example #5
0
        /// <summary>
        /// 帳簿項目の編集(複製)のために <see cref="ActionRegistrationWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedActionId">帳簿項目ID</param>
        /// <param name="mode">登録モード</param>
        public ActionRegistrationWindow(DaoBuilder builder, int selectedActionId, RegistrationMode mode = RegistrationMode.Edit)
        {
            this.builder        = builder;
            this.selectedBookId = null;
            this.selectedMonth  = null;
            this.selectedDate   = null;
            switch (mode)
            {
            case RegistrationMode.Edit:
            case RegistrationMode.Copy:
                this.selectedActionId = selectedActionId;
                break;
            }

            this.InitializeComponent();
            this.LoadWindowSetting();

            this.WVM.RegMode = mode;
        }
Example #6
0
        /// <summary>
        /// アプリケーション開始時
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            Properties.Settings settings = HouseholdAccountBook.Properties.Settings.Default;

#if DEBUG
            Debug.Listeners.Add(new ConsoleTraceListener());
#endif

#if !DEBUG
            // 多重起動を抑止する
            App.mutex = new Mutex(false, this.GetType().Assembly.GetName().Name);
            if (!mutex.WaitOne(TimeSpan.Zero, false))
            {
                Process   curProcess  = Process.GetCurrentProcess();
                Process[] processList = Process.GetProcessesByName(curProcess.ProcessName);

                if (processList.Length >= 2)
                {
                    foreach (Process process in processList)
                    {
                        if (process.Id != curProcess.Id)
                        {
                            // 外部プロセスのアクティブ化したい(Win32を使わざるを得ない)
                        }
                    }
                }

                MessageBox.Show("同時に複数起動することはできません。", MessageTitle.Exclamation);
                this.Shutdown();
                return;
            }
#endif

            this.DispatcherUnhandledException += this.App_DispatcherUnhandledException;
            this.Exit += this.App_Exit;

            // 前バージョンからのUpgradeを実行していないときはUpgradeを実施する
            Version assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            if (!Version.TryParse(settings.App_Version, out Version preVersion) || preVersion < assemblyVersion)
            {
                // Upgradeを実行する
                settings.Upgrade();
            }

            // 初回起動時
            if (settings.App_InitFlag)
            {
#if !DEBUG
                // リリースビルドの初回起動時デバッグモードはOFF
                settings.App_IsDebug = false;
#endif
                // DB設定ダイアログ終了時に閉じないように設定する(明示的なシャットダウンが必要)
                this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

                // データベース接続を設定する
                DbSettingWindow dsw    = new DbSettingWindow("DB接続設定を入力してください。");
                bool?           result = dsw.ShowDialog();

                if (result != true)
                {
                    this.connectInfo = null;
                    this.Shutdown();
                    return;
                }

                settings.App_InitFlag = false;
                settings.Save();
            }

            DaoBuilder builder = null;
            while (true)
            {
                // 接続設定を読み込む
                this.connectInfo = new DaoNpgsql.ConnectInfo()
                {
                    Host     = settings.App_Postgres_Host,
                    Port     = settings.App_Postgres_Port,
                    UserName = settings.App_Postgres_UserName,
                    Password = settings.App_Postgres_Password,
#if DEBUG
                    DatabaseName = settings.App_Postgres_DatabaseName_Debug,
#else
                    DatabaseName = settings.App_Postgres_DatabaseName,
#endif
                    Role = settings.App_Postgres_Role
                };
                builder = new DaoBuilder(this.connectInfo);

                // 接続を試行する
                bool isOpen = false;
                try {
                    using (DaoBase dao = builder.Build()) {
                        isOpen = dao.IsOpen;
                    }
                }
                catch (TimeoutException) { }

                if (isOpen)
                {
                    break;
                }
                else
                {
                    // データベース接続を設定する
                    DbSettingWindow dsw    = new DbSettingWindow("接続に失敗しました。接続設定を見直してください。");
                    bool?           result = dsw.ShowDialog();

                    if (result != true)
                    {
                        this.connectInfo = null;
                        this.Shutdown();
                        return;
                    }
                }
            }

            // 休日リストを取得する
            await DateTimeExtensions.DownloadHolidayListAsync();

            // 設定をリソースに登録する
            this.RegisterSettingsToResource();

            // DBに接続できる場合だけメインウィンドウを開く
            MainWindow mw = new MainWindow(builder);
            this.MainWindow   = mw;
            this.ShutdownMode = ShutdownMode.OnMainWindowClose;
            mw.Show();
        }
 public AsposeBudgetOriginatorJobCodeDetailsExportHandlerBuilder(string tempDirectory, DaoBuilder dao)
     : base(tempDirectory, dao)
 {
 }