示例#1
0
 private object FireRequestMessageEvent(RequestDialogFromEventArgs eventArgs)
 {
     if (RequestOnShowingDialog == null) return null;
     RequestOnShowingDialog(this, eventArgs);
     return eventArgs.Result;
 }
示例#2
0
 private void ViewManagerOnRequestDialogEventArgs(object sender, RequestDialogFromEventArgs e)
 {
     switch (e.DialogMode)
     {
         case DialogMode.Message:
             MessageDialog.Instance.ShowMessage(this, e.MessageId, e.Parameters);
             break;
         case DialogMode.FileChooser:
             openFileDialog.Filter = e.FileFilter;
             openFileDialog.Multiselect = false;
             var result = openFileDialog.ShowDialog(this);
             if (result == DialogResult.OK) e.Result = openFileDialog.FileName;
             break;
         case DialogMode.FolderChooser:
             var openFileDialogResult = folderBrowserDialog.ShowDialog(this);
             if (openFileDialogResult == DialogResult.OK) e.Result = folderBrowserDialog.SelectedPath;
             break;
         case DialogMode.SaveFile:
             saveFileDialog.Filter = e.FileFilter;
             var saveFileResult = saveFileDialog.ShowDialog(this);
             if (saveFileResult == DialogResult.OK) e.Result = saveFileDialog.FileName;
             break;
         case DialogMode.LockScreen:
             this.Enabled = false;
             break;
         case DialogMode.UnlockScreen:
             this.Enabled = true;
             break;
         default:
             break;
     }
 }