Beispiel #1
0
        /// <summary>
        /// テンプレート追加クリック時の処理
        /// </summary>
        private void AddTemplateClick()
        {
            this.EditMode = true;
            this._isNew   = true;
            this._window.cTemplateName.Focus();

            var repo = new TemplateRepo();

            this.TemplateData = repo.CreateEmptyTemplate();
            this.Name         = "";
        }
Beispiel #2
0
        /// <summary>
        /// クリアクリック時の処理
        /// </summary>
        private void ClearClick()
        {
            this.TemplateIndex = -1;
            this.EditMode      = false;
            this.TemplateData  = null;
            this._isNew        = false;

            // 既存データの場合はメモリの情報が書き換わってしまうので便宜上の対処
            // ※データ件数が少ないので通じる手法
            var repo = new TemplateRepo();

            this.TemplateList = repo.Select();
        }
Beispiel #3
0
        /// <summary>
        /// テンプレート削除クリック時の処理
        /// </summary>
        private void DeleteTemplateClick()
        {
            var repo = new TemplateRepo();

            try {
                repo.DeleteByTemplateId(this.TemplateData.Id);
                this.TemplateList.Remove(this.TemplateData);
                this.CreateTemplateNameList();
                this.ClearClick();
            } catch (Exception ex) {
                Message.ShowError(this._window, Message.ErrId.Err003, ex.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 初期処理
        /// </summary>
        private void Initialize()
        {
            // コマンドを設定
            this.AddTemplateCommand    = new DelegateCommand(AddTemplateClick);
            this.SelectTemplateCommand = new DelegateCommand(SelectTemplateClick);
            this.EditTemplateCommand   = new DelegateCommand(EditTemplateClick);
            this.DeleteTemplateCommand = new DelegateCommand(DeleteTemplateClick);
            this.SaveTemplateCommand   = new DelegateCommand(SaveTemplateClick);
            this.ClearCommand          = new DelegateCommand(ClearClick);
            this.AddLogCommand         = new DelegateCommandWithParam <long>(AddLogClick);
            this.DeleteTodoCommand     = new DelegateCommandWithParam <int>(DeleteTodoClick);

            //
            var repo = new TemplateRepo();

            this.TemplateList = repo.Select();
            this.CreateTemplateNameList();
        }
Beispiel #5
0
        /// <summary>
        /// 保存クリック時の処理
        /// </summary>
        private void SaveTemplateClick()
        {
            var repo = new TemplateRepo();

            try {
                repo.Update(this.TemplateData, this._isNew);
                if (this._isNew)
                {
                    this.TemplateList.Add(this.TemplateData);
                }

                this.TemplateList = new ObservableCollection <TemplateData>(this.TemplateList.OrderBy(n => n.Name));

                this.CreateTemplateNameList();
                this.ClearClick();
            } catch (Exception ex) {
                Message.ShowError(this._window, Message.ErrId.Err003, ex.Message);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 既存のテンプレートから追加クリック時の処理
        /// </summary>
        private void SelectTemplateClick()
        {
            var window = new TemplateSelectWindow()
            {
                Owner = this._window
            };

            if (true != window.ShowDialog())
            {
                return;
            }
            this.TemplateData = null;
            this.EditMode     = true;
            this._isNew       = true;
            this._window.cTemplateName.Focus();

            var repo = new TemplateRepo();

            this.TemplateData = repo.SelectByTemplateId(window.SelectedTemplateId);
            this.Name         = "";
        }