Example #1
0
 /// <summary>
 /// Displays the switching to ref device warning, and allows user to quit if they don't want to
 /// </summary>
 public static void DisplaySwitchingToRefWarning(Framework framework, string sampleTitle)
 {
     if (framework.IsShowingMsgBoxOnError)
         {
             // Read the registry key to see if the warning should be skipped
             int skipWarning = 0;
             try
             {
                 using(Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(SwitchRefDialog.KeyLocation))
                 {
                     skipWarning = (int)key.GetValue(SwitchRefDialog.KeyValueName, (int)0);
                 }
             }
             catch { } // Ignore any errors
             if ( (skipWarning == 0) && (firstTime) ) // Show dialog
             {
                 firstTime = false;
                 using (SwitchRefDialog dialog = new SwitchRefDialog(sampleTitle))
                 {
                     System.Windows.Forms.Application.Run(dialog);
                     if (dialog.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                     {
                         // Shutdown the application
                         framework.Dispose();
                     }
                 }
             }
         }
 }