Exemplo n.º 1
0
 private void PreviewFile(File file)
 {
     if (Viewers.HasViewer(file))
     {
         Control viewerControl = Viewers.GetControl(file);
         if (viewerControl != null)
         {
             using (var form = new ViewerForm())
             {
                 form.SetFilename(file.Name);
                 form.SetControl(viewerControl);
                 form.ShowDialog();
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Do something when double clicking the tray icon, circumvents
        /// _notifyIcon_MouseClick which has been commented out but left to
        /// show possibilities
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _notifyIcon_DoubleClick(object sender, EventArgs e)
        {
            var viewForm = new ViewerForm();

            try
            {
                if (viewForm.ShowDialog() == DialogResult.OK)
                {
                    // do something
                }
                else
                {
                    // do not perform any positive actions
                }
            }
            finally
            {
                viewForm.Dispose();
            }
        }