public CheckForUpdates(Main mainForm, CheckForUpdatesHelper checkForUpdatesHelper)
        {
            InitializeComponent();

            _mainForm = mainForm;
            _updatesHelper = checkForUpdatesHelper;
            InitLanguage();
            ShowAvailableUpdate(true);
            _performCheckOnShown = false;
        }
        private void CheckForUpdates_Shown(object sender, EventArgs e)
        {
            if (!_performCheckOnShown)
                return;

            _updatesHelper = new CheckForUpdatesHelper();
            Application.DoEvents();
            Refresh();
            _updatesHelper.CheckForUpdates();
            timerCheckForUpdates.Start();

            buttonOK.Focus();
        }
Example #3
0
        private void Main_Shown(object sender, EventArgs e)
        {
            this.toolStripButtonToggleVideo.Checked = !Configuration.Settings.General.ShowVideoPlayer;
            this.toolStripButtonToggleVideo_Click(null, null);

            this._timerAutoSave.Tick += this.TimerAutoSaveTick;
            if (Configuration.Settings.General.AutoBackupSeconds > 0)
            {
                this._timerAutoSave.Interval = 1000 * Configuration.Settings.General.AutoBackupSeconds; // take backup every x second if changes were made
                this._timerAutoSave.Start();
            }

            this.ToolStripMenuItemPlayRateNormalClick(null, null);

            SetPositionFromXYString(Configuration.Settings.General.UndockedVideoPosition, "VideoPlayerUndocked");
            SetPositionFromXYString(Configuration.Settings.General.UndockedWaveformPosition, "WaveformUndocked");
            SetPositionFromXYString(Configuration.Settings.General.UndockedVideoControlsPosition, "VideoControlsUndocked");
            if (Configuration.Settings.General.Undocked && Configuration.Settings.General.StartRememberPositionAndSize)
            {
                Configuration.Settings.General.Undocked = false;
                this.UndockVideoControlsToolStripMenuItemClick(null, null);
            }

            this.Main_Resize(null, null);

            this.toolStripButtonLockCenter.Checked = Configuration.Settings.General.WaveformCenter;
            this.audioVisualizer.Locked = this.toolStripButtonLockCenter.Checked;

            this.numericUpDownSec1.Value = (decimal)(Configuration.Settings.General.SmallDelayMilliseconds / TimeCode.BaseUnit);
            this.numericUpDownSec2.Value = (decimal)(Configuration.Settings.General.LargeDelayMilliseconds / TimeCode.BaseUnit);

            this.numericUpDownSecAdjust1.Value = (decimal)(Configuration.Settings.General.SmallDelayMilliseconds / TimeCode.BaseUnit);
            this.numericUpDownSecAdjust2.Value = (decimal)(Configuration.Settings.General.LargeDelayMilliseconds / TimeCode.BaseUnit);

            this.SetShortcuts();

            if (Configuration.Settings.General.StartInSourceView)
            {
                this.textBoxSource.Focus();
            }
            else
            {
                this.SubtitleListview1.Focus();
                int index = this.FirstSelectedIndex;
                if (index > 0 && this.SubtitleListview1.Items.Count > index)
                {
                    this.SubtitleListview1.Focus();
                    this.SubtitleListview1.Items[index].Focused = true;
                }
            }

            this.MainResize();
            this._loading = false;
            this.OpenVideo(this.VideoFileName);
            lock (_syncUndo)
            {
                this.timerTextUndo.Start();
                this.timerAlternateTextUndo.Start();
            }

            if (Configuration.IsRunningOnLinux())
            {
                this.numericUpDownDuration.Left = this.timeUpDownStartTime.Left + this.timeUpDownStartTime.Width + 10;
                this.numericUpDownDuration.Width = this.numericUpDownDuration.Width + 10;
                this.numericUpDownSec1.Width = this.numericUpDownSec1.Width + 10;
                this.numericUpDownSec2.Width = this.numericUpDownSec2.Width + 10;
                this.numericUpDownSecAdjust1.Width = this.numericUpDownSecAdjust1.Width + 10;
                this.numericUpDownSecAdjust2.Width = this.numericUpDownSecAdjust2.Width + 10;
                this.labelDuration.Left = this.numericUpDownDuration.Left;
            }

            this._timerDoSyntaxColoring.Interval = 100;
            this._timerDoSyntaxColoring.Tick += this._timerDoSyntaxColoring_Tick;

            var showBeta = Configuration.Settings.General.ShowBetaStuff;
            this.generateDatetimeInfoFromVideoToolStripMenuItem.Visible = showBeta;
            this.toolStripMenuItemExportCaptionInc.Visible = showBeta;
            this.toolStripMenuItemExportUltech130.Visible = showBeta;
            this.toolStripMenuItemInverseSelection.Visible = showBeta;
            this.toolStripMenuItemSpellCheckFromCurrentLine.Visible = showBeta;
            this.toolStripMenuItemImportOcrHardSub.Visible = showBeta;
            this.toolStripMenuItemMeasurementConverter.Visible = showBeta;
            this.toolStripMenuItemOpenDvd.Visible = showBeta;

            // toolStripMenuItemExportBdTextSt.Visible = showBeta;
            if (Configuration.Settings.General.StartRememberPositionAndSize && Configuration.Settings.General.SplitContainerMainSplitterDistance > 0 && Configuration.Settings.General.SplitContainer1SplitterDistance > 0 && Configuration.Settings.General.SplitContainerListViewAndTextSplitterDistance > 0)
            {
                this.splitContainerMain.SplitterDistance = Configuration.Settings.General.SplitContainerMainSplitterDistance;
                this.splitContainer1.SplitterDistance = Configuration.Settings.General.SplitContainer1SplitterDistance;
                this.splitContainerListViewAndText.SplitterDistance = Configuration.Settings.General.SplitContainerListViewAndTextSplitterDistance;
            }

            this.mediaPlayer.InitializeVolume(Configuration.Settings.General.VideoPlayerDefaultVolume);
            this.LoadPlugins();
            this.tabControlSubtitle.Invalidate();

            if (string.IsNullOrEmpty(Configuration.Settings.Language.CheckForUpdates.CheckingForUpdates))
            {
                this.checkForUpdatesToolStripMenuItem.Visible = false;
                this.toolStripMenuItemSplitterCheckForUpdates.Visible = false;
            }
            else if (Configuration.Settings.General.CheckForUpdates && Configuration.Settings.General.LastCheckForUpdates < DateTime.Now.AddDays(-5))
            {
                this._checkForUpdatesHelper = new CheckForUpdatesHelper();
                this._checkForUpdatesHelper.CheckForUpdates();
                this._timerCheckForUpdates = new Timer();
                this._timerCheckForUpdates.Interval = 7000;
                this._timerCheckForUpdates.Tick += this.TimerCheckForUpdatesTick;
                this._timerCheckForUpdates.Start();
                Configuration.Settings.General.LastCheckForUpdates = DateTime.Now;
            }

            this._dragAndDropTimer.Interval = 50;
            this._dragAndDropTimer.Tick += this.DoSubtitleListview1Drop;
        }
Example #4
0
        private void TimerCheckForUpdatesTick(object sender, EventArgs e)
        {
            this._timerCheckForUpdates.Stop();
            if (this._checkForUpdatesHelper.IsUpdateAvailable())
            {
                using (var form = new CheckForUpdates(this, this._checkForUpdatesHelper))
                {
                    form.ShowDialog(this);
                }
            }

            this._checkForUpdatesHelper = null;
            this._timerCheckForUpdates = null;
        }
        /// <summary>
        /// The check for updates_ shown.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void CheckForUpdates_Shown(object sender, EventArgs e)
        {
            if (!this._performCheckOnShown)
            {
                this.Activate();
                return;
            }

            this._updatesHelper = new CheckForUpdatesHelper();
            Application.DoEvents();
            this.Refresh();
            this._updatesHelper.CheckForUpdates();
            this.timerCheckForUpdates.Start();

            this.buttonOK.Focus();
            this.Activate();
        }