Ejemplo n.º 1
0
        } // constructor

        private void ConfigForm_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            selectFolder.Description = Properties.Texts.SelectFolderSaveDescription;
            openFile.Title           = Properties.Texts.OpenFileVlcTitle;
            openFile.Filter          = Properties.Texts.OpenFileVlcFilter;

            try
            {
                DefaultRecordingsSavePath = Installation.GetCurrentUserVideosFolder();
            }
            catch
            {
                DefaultRecordingsSavePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            } // try-catch

            wizardControl.Initialization[wizardPageReadme.Name]        = PageReadme_Setup;
            wizardControl.Initialization[wizardPagePrerequisites.Name] = PagePrerequisites_Setup;
            wizardControl.Initialization[wizardPageFirewall.Name]      = PageFirewall_Setup;
            wizardControl.Initialization[wizardPageBasic.Name]         = PageBasic_Setup;
            wizardControl.Initialization[wizardPageRecordings.Name]    = PageRecordings_Setup;

            wizardControl.SelectedTab = null;
            wizardControl.Visible     = false;
        } // ConfigForm_Load
Ejemplo n.º 2
0
        } // ErrorException

        private void WizardEndDialog_Load(object sender, EventArgs e)
        {
            switch (EndResult)
            {
            case System.Windows.Forms.DialogResult.OK:
                BasicGoogleTelemetry.SendScreenHit(this, "Ok");
                pictureEndIcon.Image        = Properties.Resources.Success_48x48;
                labelEndTitle.Text          = Properties.Texts.WizardEndTitleOk;
                labelEndText.Text           = string.Format(labelEndText.Text, Properties.Texts.WizardEndTextOk);
                checkRunMainProgram.Visible = true;
                checkRunMainProgram.Checked = !string.IsNullOrEmpty(Program.AppUiConfig.Folders.Install);
                checkRunMainProgram.Enabled = checkRunMainProgram.Checked;
                checkRunMainProgram.Text    = string.Format(checkRunMainProgram.Text, Properties.Texts.ProductMainProgramName);
                break;

            case System.Windows.Forms.DialogResult.Cancel:
                BasicGoogleTelemetry.SendScreenHit(this, "Cancel");
                pictureEndIcon.Image = Properties.Resources.Warning_48x48;
                labelEndTitle.Text   = Properties.Texts.WizardEndTitleCancel;
                labelEndText.Text    = string.Format(labelEndText.Text, Properties.Texts.WizardEndTextCancel);
                break;

            default:
                BasicGoogleTelemetry.SendScreenHit(this, "Abort");
                pictureEndIcon.Image     = Properties.Resources.Exclamation_48x48;
                labelEndTitle.Text       = Properties.Texts.WizardEndTitleAbort;
                labelEndText.Text        = string.Format(labelEndText.Text, Properties.Texts.WizardEndTextAbort);
                linkErrorDetails.Left    = checkRunMainProgram.Left;
                linkErrorDetails.Visible = true;
                break;
            } // switch
        }     // WizardEndDialog_Load
Ejemplo n.º 3
0
        } // DialogRecordChannel_Shown

        #endregion

        #region Form events implementation

        private void DialogRecordChannel_Load_Implementation(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            // Initialize
            if (Task == null)
            {
                if (this.DesignMode)
                {
                    Task      = RecordTask.CreateWithDefaultValues(null);
                    IsNewTask = true;
                }
                else
                {
                    throw new ArgumentNullException();
                } // if-else
            }     // if

            // General
            InitGeneralData();
            // Schedule tab
            InitScheduleData();
            // Duration tab
            InitDurationData();
            // Description tab
            InitDescriptionData();
            // Save tab
            InitSaveData();
            // Advanced tab
            InitAdvancedData();
        } // DialogRecordChannel_Load_Implementation
Ejemplo n.º 4
0
        } // ShowConfigurationForm

        public static T ShowConfigurationForm <T>(IWin32Window owner, string settingsGuid, T overrideSettings) where T : class, IConfigurationItem
        {
            var registration = AppUiConfiguration.Current.ItemsRegistry[new Guid(settingsGuid)];
            var data         = new ConfigurationItem()
            {
                Registration = registration,
                ExistingData = overrideSettings ?? AppUiConfiguration.Current[registration.DirectIndex]
            };
            var items = new List <ConfigurationItem>(1);

            items.Add(data);

            using (var form = new ConfigurationForm())
            {
                BasicGoogleTelemetry.SendScreenHit(form, data.Registration.ItemType.Name);
                form.ConfigurationItems = items;
                var dialogResult = form.ShowDialog(owner);
                if (dialogResult != DialogResult.OK)
                {
                    return(null);
                }
                else
                {
                    return((T)items[0].NewData);
                } // if-else
            }     // using
        }         // ShowConfigurationForm
Ejemplo n.º 5
0
        }     // WizardTabControl_Selected

        protected override void OnSelecting(TabControlCancelEventArgs e)
        {
            bool isAllowed;

            base.OnSelecting(e);
            if (DesignMode)
            {
                return;
            }

            if (e.TabPage == null)
            {
                return;
            }

            isAllowed = (IsPageAllowed.TryGetValue(e.TabPage.Name, out isAllowed)) ? isAllowed : false;
            e.Cancel  = !isAllowed;

            if (isAllowed)
            {
                Action init;

                if (Initialization.TryGetValue(e.TabPage.Name, out init))
                {
                    Initialization.Remove(e.TabPage.Name);
                    init();
                    BasicGoogleTelemetry.SendScreenHit(this.FindForm(), e.TabPage.Text);
                } // if
            }     // if
        }         // OnSelecting
Ejemplo n.º 6
0
        static int Main(string[] arguments)
        {
            // set thread name for debugging
            Thread.CurrentThread.Name = "Program main thread";

            //Application.ThreadException += Application_ThreadException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var appContext = new MyApplicationContext();

            Application.Run(appContext);
            var exitCode = appContext.ExitCode;

            appContext.Dispose();

            BasicGoogleTelemetry.SendScreenHit("ChannelList_Main: End");
            BasicGoogleTelemetry.ManageSession(true);
            BasicGoogleTelemetry.EnsureHitsSents();

            // Ensure all background threads end right now (like updating the EPG data with EpgDownloader)
            // TODO: Don't to this
            Thread.Sleep(1000);
            Environment.Exit(exitCode);

            return(exitCode);
        } // Main
Ejemplo n.º 7
0
        } // constructor

        private void PropertiesDialog_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this, Caption);
            this.Text = Caption;
            this.labelDescription.Text    = (Description ?? Properties.PropertiesDialog.CaptionDefault);
            this.pictureBoxItemIcon.Image = ItemIcon;
        } // PropertiesDialog_Load
Ejemplo n.º 8
0
        }     // ChannelListForm_Load

        private void ChannelListForm_Shown(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this, "Shown");
            if (SelectedServiceProvider == null)
            {
                SafeCall(SelectProvider);
            } // if
        }     // ChannelListForm_Shown
Ejemplo n.º 9
0
        } // buttonProviderDetails_Click

        #region Event handlers implemention

        private void SelectProviderDialog_Load_Implementation(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            if (SelectedServiceProvider == null)
            {
                SelectedIndexChanged();
            } // if
            LoadServiceProviderList(true);
        }     // SelectProviderDialog_Load_Implementation
Ejemplo n.º 10
0
        } // menuItemChannelRefreshList_Click_Implementation

        private void menuItemChannelVerify_Click_Implementation(object sender, EventArgs e)
        {
            int timeout;

            MulticastScannerOptionsDialog.ScanWhatList list;
            IEnumerable <UiBroadcastService>           whatList;

            if ((MulticastScanner != null) && (!MulticastScanner.IsDisposed))
            {
                MulticastScanner.Activate();
                return;
            } // if

            using (var dialog = new MulticastScannerOptionsDialog())
            {
                var result = dialog.ShowDialog(this);
                BasicGoogleTelemetry.SendScreenHit(this);
                if (result != DialogResult.OK)
                {
                    return;
                }
                timeout = dialog.Timeout;
                list    = dialog.ScanList;
            } // using

            // filter whole list, if asked for
            switch (list)
            {
            case MulticastScannerOptionsDialog.ScanWhatList.ActiveServices:
                whatList = from service in BroadcastDiscovery.Services
                           where service.IsInactive == false
                           select service;
                break;

            case MulticastScannerOptionsDialog.ScanWhatList.DeadServices:
                whatList = from service in BroadcastDiscovery.Services
                           where service.IsInactive == true
                           select service;
                break;

            default:
                whatList = BroadcastDiscovery.Services;
                break;
            } // switch

            MulticastScanner = new MulticastScannerDialog()
            {
                Timeout           = timeout,
                BroadcastServices = whatList,
            };
            MulticastScanner.ChannelScanResult += MulticastScanner_ChannelScanResult;
            MulticastScanner.Disposed          += MulticastScanner_Disposed;
            MulticastScanner.ScanCompleted     += MulticastScanner_ScanCompleted;
            MulticastScanner.Show(this);
        }  // menuItemChannelVerify_Click_Implementation
Ejemplo n.º 11
0
        }     // ShowEpgBasicData

        private void FormBasicEpgData_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            pictureChannelLogo.Image = Service.Logo.GetImage(LogoSize.Size48, true);
            labelChannelName.Text    = string.Format("{0}\r\n{1}", Service.DisplayLogicalNumber, Service.DisplayName);

            EpgProgramBefore.DisplayData(Service, (EpgPrograms != null) ? EpgPrograms[0] : null, ReferenceTime, Properties.Texts.EpgProgramBeforeCaption);
            EpgProgramNow.DisplayData(Service, (EpgPrograms != null) ? EpgPrograms[1] : null, ReferenceTime, Properties.Texts.EpgProgramNowCaption);
            EpgProgramThen.DisplayData(Service, (EpgPrograms != null) ? EpgPrograms[2] : null, ReferenceTime, Properties.Texts.EpgProgramThenCaption);
        } // FormBasicEpgData_Load
Ejemplo n.º 12
0
        } // SetWizardResult

        static int LaunchWizard()
        {
            InitializationResult initResult;
            bool launchMainProgram = false;
            int  result            = 0;

            WizardEndResult = DialogResult.Abort;

            AppUiConfig = Installation.LoadRegistrySettings(out initResult);
            if (AppUiConfig == null)
            {
                Program.SetWizardResult(DialogResult.Abort, string.Format("{0}\r\n{1}", initResult.Caption, initResult.Message), initResult.InnerException);
                goto End;
            } // if
            BasicGoogleTelemetry.Init(Properties.Resources.AnalyticsGoogleTrackingId, AppUiConfig.AnalyticsClientId, true, true, true);

            using (var dlg = new WizardWelcomeDialog())
            {
                switch (dlg.ShowDialog())
                {
                case DialogResult.Cancel:
                    Program.SetWizardResult(DialogResult.Cancel);
                    goto End;
                } // switch
            }     // using

            using (var dlg = new ConfigForm())
            {
                dlg.ShowDialog();
            } // using dlg

End:
            using (var dlg = new WizardEndDialog())
            {
                dlg.EndResult      = WizardEndResult;
                dlg.ErrorMessage   = WizardEndText;
                dlg.ErrorException = WizardEndException;
                dlg.ShowDialog();

                launchMainProgram = dlg.checkRunMainProgram.Checked;
                result            = (WizardEndResult == DialogResult.OK) ? 0 : -1;
            } // using

            if (launchMainProgram)
            {
                var message = Installation.Launch(null, AppUiConfig.Folders.Install, Properties.Resources.SuccessExecuteProgram);
                if (message != null)
                {
                    MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                } // if
            }     // if

            return(result);
        } // LaunchWizard
Ejemplo n.º 13
0
        }     // ShowRtfHelp

        public static DialogResult ShowPlainTextHelp(IWin32Window owner, string helpText, string caption = null)
        {
            using (var dialog = new HelpDialog())
            {
                BasicGoogleTelemetry.SendScreenHit(dialog, caption);
                dialog.richTextHelp.Text = helpText;
                if (caption != null)
                {
                    dialog.Text = caption;
                }
                return(dialog.ShowDialog(owner));
            } // using dialog
        }     // ShowRtfHelp
Ejemplo n.º 14
0
        } // DisposeForm

        private void EpgChannelPrograms_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            pictureChannelLogo.Image = Service.Logo.GetImage(LogoSize.Size48, true);
            labelChannelName.Text    = string.Format("{0} - {1}", Service.DisplayLogicalNumber, Service.DisplayName);

            BoldListFont   = new Font(listPrograms.Font, FontStyle.Bold);
            ItalicListFont = new Font(listPrograms.Font, FontStyle.Italic);

            comboBoxDate.SelectedIndex   = DaysDelta;
            buttonDisplayChannel.Enabled = false;
            buttonRecordChannel.Enabled  = false;
        } // EpgChannelPrograms_Load
Ejemplo n.º 15
0
        } // RecorderLauncherPath

        #region HandleException methods

        public static void HandleException(Form owner, Exception ex)
        {
            BasicGoogleTelemetry.SendExtendedExceptionHit(ex);
            AddExceptionAdvancedInformation(ex);

            var box = new Microsoft.SqlServer.MessageBox.ExceptionMessageBox()
            {
                Caption = Properties.Texts.MyAppHandleExceptionDefaultCaption,
                Message = ex,
                Beep    = true,
                Symbol  = ExceptionMessageBoxSymbol.Error,
            };

            box.Show(owner);
        } // HandleException
Ejemplo n.º 16
0
        } // HandleException

        public static void HandleException(Form owner, string caption, string message, MessageBoxIcon icon, Exception ex)
        {
            BasicGoogleTelemetry.SendExtendedExceptionHit(ex, true, message, null);
            AddExceptionAdvancedInformation(ex);

            var box = new ExceptionMessageBox()
            {
                Caption        = caption ?? Properties.Texts.MyAppHandleExceptionDefaultCaption,
                Text           = message ?? Properties.Texts.MyAppHandleExceptionDefaultMessage,
                InnerException = ex,
                Beep           = true,
                Symbol         = TranslateIconToSymbol(icon),
            };

            box.Show(owner);
        } // HandleException
Ejemplo n.º 17
0
        }     // Implementation_menuItemProviderDetails_Click

        private void SelectProvider()
        {
            using (var dialog = new SelectProviderDialog())
            {
                dialog.SelectedServiceProvider = SelectedServiceProvider;
                var result = dialog.ShowDialog(this);
                BasicGoogleTelemetry.SendScreenHit(this);
                if (result != DialogResult.OK)
                {
                    return;
                }

                SelectedServiceProvider = dialog.SelectedServiceProvider;
                ServiceProviderChanged();
            } // dialog
        }     // SelectProvider
Ejemplo n.º 18
0
        private void contextMenuListExportM3u_Click_Implementation(object sender, EventArgs e)
        {
            string filename;

            using (var fileDialog = new SaveFileDialog()
            {
                AddExtension = true,
                AutoUpgradeEnabled = true,
                CheckPathExists = true,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                OverwritePrompt = true,
                RestoreDirectory = true,
                ShowHelp = false,
                SupportMultiDottedExtensions = true,
                Title = contextMenuListExportM3u.Text,
                ValidateNames = true,
                DefaultExt = "m3u",
                Filter = ".m3u|*.m3u",
            })
            {
                if (fileDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                filename = fileDialog.FileName;
            } // using

            BasicGoogleTelemetry.SendEventHit("Feature", "contextMenuListExportM3u", "contextMenuListExportM3u.Text", this.GetType().Name);

            var sortedServices = from service in ListManager.BroadcastServices
                                 orderby service.DisplayLogicalNumber
                                 select service;

            var output = new StringBuilder();

            output.AppendLine("#EXTM3U");

            foreach (var service in sortedServices)
            {
                output.AppendFormat("#EXTINF:-1,[{0}] {1}", service.DisplayLogicalNumber, service.DisplayName);
                output.AppendLine();
                output.AppendLine(service.DisplayLocationUrl);
            } // foreach service

            File.WriteAllText(filename, output.ToString(), Encoding.UTF8);
        } // contextMenuListExportM3u_Click_Implementation
Ejemplo n.º 19
0
        } // constructor

        public static void ShowBox(IWin32Window owner, string context)
        {
            using (var box = new NotImplementedBox())
            {
                if (context == null)
                {
                    context = owner.GetType().Name;
                }
                else
                {
                    string.Format("{0}/{1}", owner.GetType().Name, context);
                } // if-else

                BasicGoogleTelemetry.SendScreenHit(box, context);
                box.ShowDialog(owner);
            } // using
        }     // ShowBox
Ejemplo n.º 20
0
        } // BroadcastServicesCount

        #region Form events

        private void DialogMulticastServiceScanner_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            FormatProgressPercentage = labelProgressPercentage.Text;
            FormatScanningProgress   = labelScanning.Text;
            FormatEllapsedTime       = labelEllapsedTime.Text;

            BroadcastServicesCount = BroadcastServices.Count();
            DisplayStats(new Stats()
            {
                Total = BroadcastServicesCount
            });
            labelEllapsedTime.Text        = null;
            labelServiceName.Text         = null;
            labelServiceUrl.Text          = null;
            pictureBoxServiceLogo.Visible = false;
            buttonRequestCancel.Enabled   = false;
        } // DialogMulticastServiceScanner_Load
Ejemplo n.º 21
0
        }     // ToString

        private void RecordTasksDialog_Shown(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            AsyncResult result;

            using (var worker = new BackgroundWorkerDialog())
            {
                worker.Options = new BackgroundWorkerOptions()
                {
                    TaskDescription = TasksTexts.ObtainingListDescription,
                    OutputData      = new AsyncResult(),
                    BackgroundTask  = AsyncBuildList,
                    AllowAutoClose  = true,
                };
                worker.ShowDialog(this);
                result = worker.Options.OutputData as AsyncResult;
                if (worker.Options.OutputException != null)
                {
                    HandleException(new ExceptionEventData(TasksTexts.ObtainingListException, worker.Options.OutputException));
                    return;
                } // if
                if ((worker.DialogResult != DialogResult.OK) || (worker.Options.OutputData == null))
                {
                    return;
                }
            } // using worker

            listViewTasks.BeginUpdate();
            listViewTasks.Items.AddRange(result.items);
            listViewTasks.EndUpdate();

            if (listViewTasks.Items.Count == 0)
            {
                listViewTasks.Enabled   = false;
                textBoxTaskDetails.Text = TasksTexts.ListEmpty;
            }
            else
            {
                HandleListViewTasksSelectedIndexChanged();
            } // if-else
        }     // RecordTasksDialog_Shown
Ejemplo n.º 22
0
        } // ChannelListForm_FormClosing

        #endregion

        #region Form event handlers implementation

        private void ChannelListForm_Load_Implementation(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this, "Load");

            this.Text = Properties.Texts.AppCaption;

            // disable functionality
            menuItemDvbRecent.Enabled   = enable_menuItemDvbRecent;
            menuItemDvbPackages.Enabled = enable_menuItemDvbPackages;
            menuItemDvbExport.Enabled   = enable_menuItemDvbExport;

            var settings = UiBroadcastListSettingsRegistration.Settings;

            ListManager = new UiBroadcastListManager(listViewChannelList, settings, imageListChannels, imageListChannelsLarge, true);
            ListManager.SelectionChanged += ListManager_SelectionChanged;
            ListManager.StatusChanged    += ListManager_StatusChanged;

            SetupContextMenuList();

            // Empty notifications
            Notify(null, null, -1);

            // set-up EPG functionality
            EpgDatastore            = new EpgMemoryDatastore();
            enable_Epg              = AppUiConfiguration.Current.User.Epg.Enabled;
            epgMiniGuide.IsDisabled = !enable_Epg;
            if (epgMiniGuide.IsDisabled)
            {
                foreach (ToolStripItem item in menuItemEpg.DropDownItems)
                {
                    item.Enabled = false;
                } // foreach
            }     // if

            // load from cache, if available
            SelectedServiceProvider = SelectProviderDialog.GetLastUserSelectedProvider(Properties.Settings.Default.LastSelectedServiceProvider);
            ServiceProviderChanged();

            // notify Splash Screeen the form has finished loading and is about to be shown
            FormLoadCompleted?.Invoke(this, e);
        } // ChannelListForm_Load_Implementation
Ejemplo n.º 23
0
        } // ApplicationData

        private void AboutBox_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this, Assembly.GetEntryAssembly().GetName().Name);
            this.Text = String.Format(this.Text, Assembly.GetEntryAssembly().GetName().Name);
            if (ApplicationData != null)
            {
                if (ApplicationData.LargeIcon != null)
                {
                    if (logoPictureBox.Image != null)
                    {
                        logoPictureBox.Image.Dispose();
                    }
                    logoPictureBox.Image = ApplicationData.LargeIcon;
                } // if
                labelAppName.Text    = string.Format("{0}", ApplicationData.Name);
                labelAppVersion.Text = string.Format("{0} - {1}", ApplicationData.Version, ApplicationData.Status);
                if (ApplicationData.LicenseTextRtf != null)
                {
                    textBoxDescription.Rtf = ApplicationData.LicenseTextRtf;
                }
                else
                {
                    textBoxDescription.Text = ApplicationData.LicenseText;
                } // if-else
            }
            else
            {
                labelAppName.Text          = AssemblyTitle;
                labelAppVersion.Text       = AssemblyVersion;
                labelEULA.Visible          = false;
                textBoxDescription.Visible = false;
            } // if-else

            labelProductName.Text = AssemblyProduct;
            labelVersion.Text     = String.Format(labelVersion.Text, AssemblyVersion);
            labelCopyright.Text   = AssemblyCopyright;
            labelCompanyName.Text = AssemblyCompany;
        } // AboutBox_Load
Ejemplo n.º 24
0
        } // GetMainForm

        #endregion

        #region Initialization methods

        private InitializationResult LoadConfiguration()
        {
            InitializationResult result;

            try
            {
                result = AppUiConfiguration.Load(null, ConfigLoadDisplayProgress);
                if (result.IsError)
                {
                    return(result);
                }

                result = ValidateConfiguration(AppUiConfiguration.Current);
                if (result.IsError)
                {
                    return(result);
                }

                BasicGoogleTelemetry.Init(Properties.InvariantTexts.AnalyticsGoogleTrackingId,
                                          AppUiConfiguration.Current.AnalyticsClientId,
                                          AppUiConfiguration.Current.User.Telemetry.Enabled,
                                          AppUiConfiguration.Current.User.Telemetry.Usage,
                                          AppUiConfiguration.Current.User.Telemetry.Exceptions);

                BasicGoogleTelemetry.SendScreenHit("SplashScreen");

                return(InitializationResult.Ok);
            }
            catch (Exception ex)
            {
                return(new InitializationResult()
                {
                    Caption = Properties.Texts.MyAppLoadConfigExceptionCaption,
                    Message = Properties.Texts.MyAppLoadConfigException,
                    InnerException = ex
                });
            } // try-catch
        }     // LoadConfiguration
Ejemplo n.º 25
0
        static int Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProcessArguments(arguments);

            if (!RunFirewallConfiguration)
            {
                var result = LaunchWizard();
                BasicGoogleTelemetry.EnsureHitsSents();

                return(result);
            }
            else
            {
                using (var dlg = new FirewallForm())
                {
                    dlg.ShowDialog();
                    return((dlg.DialogResult == DialogResult.OK) ? 0 : (dlg.DialogResult == DialogResult.Cancel) ? 1 : -1);
                } // using dlg
            }     // if-else
        }         // Main
Ejemplo n.º 26
0
        private void HandleException(IWin32Window owner, Exception ex)
        {
            string message;

            BasicGoogleTelemetry.SendExtendedExceptionHit(ex, false, TelemetryScreenName, TelemetryScreenName);

            var isSocket  = ex as SocketException;
            var isTimeout = ex as TimeoutException;

            message = TextDownloadException ?? Properties.Texts.HelperExceptionText;
            if (isSocket != null)
            {
                message = string.Format(Properties.Texts.SocketException, message, isSocket.SocketErrorCode);
            }
            else if (isTimeout != null)
            {
                message = string.Format(Properties.Texts.TimeoutException, message);
            }

            var box = new ExceptionMessageBox()
            {
                Buttons        = ExceptionMessageBoxButtons.Custom,
                InnerException = ex,
                Text           = message,
                DefaultButton  = ExceptionMessageBoxDefaultButton.Button2,
                CustomSymbol   = Properties.Resources.DvbStpDownload_Error_48x48
            };

            box.SetButtonText(ExceptionMessageBox.OKButtonText, Properties.Texts.HandleExceptionHelpButton);
            box.Show(owner);

            if (box.CustomDialogResult == ExceptionMessageBoxDialogResult.Button2)
            {
                BasicGoogleTelemetry.SendEventHit("ShowDialog", "UiServices.DvbStpClient.HelpDialog", TelemetryScreenName, TelemetryScreenName);
                HelpDialog.ShowRtfHelp(owner, Properties.Texts.RtfTroubleshootingGuide, null);
            } // if
        }     // HandleException
Ejemplo n.º 27
0
        } // constructor

        #region Event handlers

        private void EpgBasicGridDialog_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);

            EpgPrograms = new IEpgLinkedList[ServicesList.Count];
            ChangeSelectedRow(-1);

            var workerOptions = new BackgroundWorkerOptions()
            {
                OutputData        = EpgPrograms,
                BackgroundTask    = AsyncGetEpgPrograms,
                AfterTask         = FillGrid,
                AllowAutoClose    = true,
                TaskDescription   = Properties.Texts.EpgDataLoadingList,
                AllowCancelButton = true,
            };

            var result = BackgroundWorkerDialog.RunWorkerAsync(this, workerOptions);
            var close  = false;

            if (workerOptions.OutputException != null)
            {
                HandleException(new ExceptionEventData(Properties.Texts.ObtainingListException, workerOptions.OutputException));
                close = true;
            } // if
            if (result != DialogResult.OK)
            {
                close = true;
            } // if

            if (close)
            {
                Visible = false;
                Close();
            } // if
        }     // EpgBasicGridDialog_Load
Ejemplo n.º 28
0
        } // HandleOwnedFormException

        /// <summary>
        /// Exception handler.
        /// By default displays an ExceptionMessageBox. Descendants are encouraged to provide their own implementation.
        /// </summary>
        /// <param name="ex">The data about the exception, including additional information for the user, such a caption or a text</param>
        /// <remarks>Descendants who override this method MUST NOT call base.ExceptionHandler.
        /// This method MUST NOT be called directly. To handle and exception, HandleException MUST be used instead.
        /// </remarks>
        protected virtual void ExceptionHandler(ExceptionEventData ex)
        {
            BasicGoogleTelemetry.SendExtendedExceptionHit(ex.Exception, true, ex.Message, this.GetType().Name);

            var box = new ExceptionMessageBox()
            {
                Caption = Properties.CommonForm.UncaughtExceptionCaption,
                Buttons = ExceptionMessageBoxButtons.OK,
                Symbol  = ExceptionMessageBoxSymbol.Stop,
            };

            if (ex.Message == null)
            {
                box.Text    = ex.Exception.Message;
                box.Message = ex.Exception;
            }
            else
            {
                box.Text           = ex.Message;
                box.InnerException = ex.Exception;
            } // if-else

            box.Show(ParentForm);
        } // ExceptionHandler
Ejemplo n.º 29
0
        }  // Dialog_Load

        private void Dialog_Shown(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(TelemetryScreenName);
            StartDownload();
        } // Dialog_Shown
Ejemplo n.º 30
0
        } // ScanList

        private void MulticastScannerOptionsDialog_Load(object sender, EventArgs e)
        {
            BasicGoogleTelemetry.SendScreenHit(this);
        } // MulticastScannerOptionsDialog_Load