コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                foreach (string arg in args)
                {
                    if (arg.StartsWith("-d", true, System.Globalization.CultureInfo.InvariantCulture) || arg.StartsWith("/d", true, System.Globalization.CultureInfo.InvariantCulture))
                    {
                        DemoMode = true;
                    }

                    if (arg.StartsWith("-admin", true, System.Globalization.CultureInfo.InvariantCulture) || arg.StartsWith("/admin", true, System.Globalization.CultureInfo.InvariantCulture))
                    {
                        AdminMode = true;
                    }

                    if (arg.StartsWith("-r", true, System.Globalization.CultureInfo.InvariantCulture) || arg.StartsWith("/r", true, System.Globalization.CultureInfo.InvariantCulture))
                    {
                        RemoteMode = true;
                    }
                }

                if (Properties.Settings.Default.UICulture == null || Properties.Settings.Default.UICulture.Length == 0)
                {
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
                }
                else
                {
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(Properties.Settings.Default.UICulture);
                }

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.DoEvents();

                global::Controls.LoadingDialog.ShowDialog(null, CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.Program_Initializing), Properties.Resources.loading, false, 0);

                MainForm mainForm = new MainForm();

                mainForm.ProcessCommandArgs(args);

                Application.Run(mainForm);
            }
            catch (Exception ex)
            {
                if (ex is System.Threading.ThreadAbortException)
                {
                    System.Threading.Thread.ResetAbort();
                }
                else
                {
                    RemotingExceptionManager.ProcessException(ex);
                }
            }
        }
コード例 #2
0
 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     if (e.Exception is System.Threading.ThreadAbortException)
     {
         System.Threading.Thread.ResetAbort();
     }
     else
     {
         RemotingExceptionManager.ProcessException(e.Exception);
     }
 }
コード例 #3
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject is System.Threading.ThreadAbortException)
     {
         System.Threading.Thread.ResetAbort();
     }
     else
     {
         RemotingExceptionManager.ProcessException((Exception)e.ExceptionObject);
     }
 }
コード例 #4
0
        private void ConfigureUI()
        {
            pnlNewVersion.Visible = false;

            try
            {
                LoadSkin();

                // Check to see if we've already choosen a version of CB to run
                if (ManagementInterfaceClient.ManagementInterface.ProductID == null || ManagementInterfaceClient.ManagementInterface.ProductID.Length == 0)
                {
                    ChooseEdition(true);
                }

                /*if (Properties.Settings.Default.UpdateNotification && Utils.NotificationUtils.IsNewVersionAvailable(ManagementInterfaceClient.ManagementInterface.ProductID, Application.ProductVersion))
                 * {
                 *  pnlNewVersion.Visible = true;
                 * }*/

                LoadApplicationPermissions();

                this.Text             = ManagementInterfaceClient.ManagementInterface.ProductDescription;
                mnuExpertMode.Checked = ManagementInterfaceClient.ManagementInterface.ExpertModeEnabled;
                ChangeUserMode(mnuExpertMode.Checked);

                mnuPurchase.Visible = true;
                if (Properties.Settings.Default.ManagementInterfaceType != WOSI.CallButler.ManagementInterface.CallButlerManagementInterfaceType.Hosted)
                {
                    // Check our license for this server
                    if (!ManagementInterfaceClient.ManagementInterface.IsFreeVersion)
                    {
                        DateTime expDate;

                        if (ManagementInterfaceClient.ManagementInterface.IsLicensed)
                        {
                            expDate = ManagementInterfaceClient.ManagementInterface.LicenseExpiration;
                        }
                        else
                        {
                            expDate = ManagementInterfaceClient.ManagementInterface.TrialExpiration;
                        }

                        global::Controls.LoadingDialog.HideDialog();

                        Forms.NagForm nagForm = new CallButler.Manager.Forms.NagForm();

                        if (expDate > DateTime.MinValue && expDate >= DateTime.Now)
                        {
                            int daysLeft = (int)((TimeSpan)(expDate - DateTime.Now)).TotalDays;

                            nagForm.StatusText = String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_Expires), daysLeft);
                            nagForm.ShowDialog(this);
                        }
                        else if (expDate > DateTime.MinValue && expDate < DateTime.Now)
                        {
                            nagForm.StatusText      = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_Expired);
                            nagForm.StatusTextColor = Color.Firebrick;
                            pnlExpired.Visible      = true;
                            nagForm.ShowDialog(this);
                        }
                        else
                        {
                            mnuPurchase.Visible = false;
                        }

                        if (nagForm.EnterLicense)
                        {
                            LicenseRegistration();
                        }
                    }
                }

                bool firstTime = !ManagementInterfaceClient.ManagementInterface.IsDownloadRegistered;

                if (firstTime || ManagementInterfaceClient.ManagementInterface.GetFirstTimeRun(ManagementInterfaceClient.AuthInfo))
                {
                    global::Controls.LoadingDialog.HideDialog();

                    ShowQuickStartWizard(firstTime, true);
                }
                else
                {
                    LoadViewControl(new SummaryView());
                }

                if (!this.Visible)
                {
                    this.Show();
                }

                // Show our info form
                string splashInfo = ManagementInterfaceClient.ManagementInterface.SplashInfo;

                if (splashInfo != null && splashInfo.Length > 0)
                {
                    Forms.StartInfoForm sif = new CallButler.Manager.Forms.StartInfoForm(splashInfo);

                    global::Controls.LoadingDialog.HideDialog();

                    sif.ShowDialog(this);
                }
            }
            catch (Exception e)
            {
                RemotingExceptionManager.ProcessException(e);
                return;
            }
        }