コード例 #1
0
        /// <summary>
        /// Shows an FileDialog.
        /// </summary>
        public void Show()
        {
            _form.Invoke((MethodInvoker) delegate {
                // Showing dialog and waiting for result
                var dialogResult = _form.OpenFileDialog.ShowDialog(_form);

                // Creating dictionary in order to store detailed information about dialog result
                var details = new Dictionary <string, object>();
                details.Add("dialogResult", dialogResult.ToString());
                details.Add("files", dialogResult == DialogResult.OK ? _form.OpenFileDialog.FileNames : new string[0]);

                // Converting dictionary into json-string and firing event on Cef side.
                var jsonContent = JsonConvert.SerializeObject(details);
                _form.TriggerChromiumEvent((string)_form.OpenFileDialog.Tag, jsonContent);
            });
        }
コード例 #2
0
 /// <summary>
 /// Set window state to be maximized
 /// </summary>
 public void Maximize()
 {
     _form.Invoke((MethodInvoker) delegate {
         _form.WindowState = FormWindowState.Maximized;
     });
 }