Exemplo n.º 1
0
        public CheckForUpdates(Main mainForm, CheckForUpdatesHelper checkForUpdatesHelper)
        {
            InitializeComponent();

            _mainForm = mainForm;
            _updatesHelper = checkForUpdatesHelper;
            InitLanguage();
            ShowAvailableUpdate(true);
            _performCheckOnShown = false;
        }
Exemplo n.º 2
0
        private void CheckForUpdates_Shown(object sender, EventArgs e)
        {
            if (!_performCheckOnShown)
            {
                Activate();
                return;
            }

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

            buttonOK.Focus();
            Activate();
        }
Exemplo n.º 3
0
 private void TimerCheckForUpdatesTick(object sender, EventArgs e)
 {
     _timerCheckForUpdates.Stop();
     if (_checkForUpdatesHelper.IsUpdateAvailable())
     {
         using (var form = new CheckForUpdates(this, _checkForUpdatesHelper))
         {
             form.ShowDialog(this);
         }
     }
     _checkForUpdatesHelper = null;
     _timerCheckForUpdates = null;
 }
Exemplo n.º 4
0
        private void Main_Shown(object sender, EventArgs e)
        {
            toolStripButtonToggleVideo.Checked = !Configuration.Settings.General.ShowVideoPlayer;
            toolStripButtonToggleVideo_Click(null, null);

            _timerAutoSave.Tick += TimerAutoSaveTick;
            if (Configuration.Settings.General.AutoBackupSeconds > 0)
            {
                _timerAutoSave.Interval = 1000 * Configuration.Settings.General.AutoBackupSeconds; // take backup every x second if changes were made
                _timerAutoSave.Start();
            }
            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;
                UndockVideoControlsToolStripMenuItemClick(null, null);
            }
            Main_Resize(null, null);

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

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

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

            SetShortcuts();

            if (Configuration.Settings.General.StartInSourceView)
            {
                textBoxSource.Focus();
            }
            else
            {
                SubtitleListview1.Focus();
                int index = FirstSelectedIndex;
                if (index > 0 && SubtitleListview1.Items.Count > index)
                {
                    SubtitleListview1.Focus();
                    SubtitleListview1.Items[index].Focused = true;
                }
            }
            MainResize();
            _loading = false;
            OpenVideo(_videoFileName);
            lock (_syncUndo)
            {
                timerTextUndo.Start();
                timerAlternateTextUndo.Start();
            }
            if (Configuration.IsRunningOnLinux())
            {
                numericUpDownDuration.Left = timeUpDownStartTime.Left + timeUpDownStartTime.Width + 10;
                numericUpDownDuration.Width += 10;
                numericUpDownSec1.Width += 10;
                numericUpDownSec2.Width += 10;
                numericUpDownSecAdjust1.Width += 10;
                numericUpDownSecAdjust2.Width += 10;
                labelDuration.Left = numericUpDownDuration.Left;
            }

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

            var showBeta = Configuration.Settings.General.ShowBetaStuff;
            generateDatetimeInfoFromVideoToolStripMenuItem.Visible = showBeta;
            toolStripMenuItemExportCaptionInc.Visible = showBeta;
            toolStripMenuItemExportUltech130.Visible = showBeta;
            toolStripMenuItemInverseSelection.Visible = showBeta;
            toolStripMenuItemSpellCheckFromCurrentLine.Visible = showBeta;
            toolStripMenuItemImportOcrHardSub.Visible = showBeta;
            toolStripMenuItemMeasurementConverter.Visible = showBeta;
            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)
            {
                splitContainerMain.SplitterDistance = Configuration.Settings.General.SplitContainerMainSplitterDistance;
                splitContainer1.SplitterDistance = Configuration.Settings.General.SplitContainer1SplitterDistance;
                splitContainerListViewAndText.SplitterDistance = Configuration.Settings.General.SplitContainerListViewAndTextSplitterDistance;
            }
            mediaPlayer.InitializeVolume(Configuration.Settings.General.VideoPlayerDefaultVolume);
            LoadPlugins();
            tabControlSubtitle.Invalidate();

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