示例#1
0
 private void FileDocument_RequestOpenFileDialog(object sender, FileDialogEventArgs e)
 {
     this.openFileDialog.Filter      = e.Filter;
     this.openFileDialog.FilterIndex = e.FilterIndex;
     if (this.openFileDialog.ShowDialog() == DialogResult.OK)
     {
         e.FileName = this.openFileDialog.FileName;
     }
     else
     {
         e.Canceled = true;
     }
 }
示例#2
0
        /// <summary>
        /// 名前を付けて保存します。
        /// </summary>
        /// <returns></returns>
        public virtual bool SaveAsDocument()
        {
            FileDialogEventArgs e = new FileDialogEventArgs()
            {
                FileName = this.FileName
            };

            this.OnRequestSaveFileDialog(e);
            if (!e.Canceled)
            {
                return(this.SaveAsDocument(e.FileName));
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// ファイルを開きます。
        /// </summary>
        /// <returns></returns>
        public virtual bool OpenDocument()
        {
            //シングルドキュメントの場合、現在のドキュメントを閉じる
            if (!this.ConfirmCloseDocument())
            {
                return(false);
            }
            FileDialogEventArgs e = new FileDialogEventArgs()
            {
                FileName = this.FileName
            };

            this.OnRequestOpenFileDialog(e);
            if (!e.Canceled)
            {
                return(this.OpenDocument(e.FileName, false));
            }
            return(false);
        }
示例#4
0
 /// <summary>
 /// RequestSaveFileDialogイベントを発生させます。
 /// </summary>
 /// <param name="e"></param>
 public void RaiseRequestSaveFileDialog(FileDialogEventArgs e)
 {
     this.OnRequestSaveFileDialog(e);
 }
示例#5
0
 /// <summary>
 /// RequestSaveFileDialogイベントを発生させます。
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnRequestSaveFileDialog(FileDialogEventArgs e)
 {
     this.RequestSaveFileDialog?.Invoke(this, e);
 }
示例#6
0
 /// <summary>
 /// OnRequestSaveFileDialogメソッドをオーバーライドします。
 /// </summary>
 /// <param name="e"></param>
 protected override void OnRequestSaveFileDialog(FileDialogEventArgs e)
 {
     e.Filter      = this.Filter;
     e.FilterIndex = this.FilterIndex;
     base.OnRequestSaveFileDialog(e);
 }