Exemplo n.º 1
0
        private void FlushHistory()
        {
            var emptyNodeAlways = Xml.GetEmptyNodeAlways(_preferences.XmlDoc.DocumentElement, "History");

            foreach (var str in _history)
            {
                Xml.SetNewValue(emptyNodeAlways, "Item", str);
            }
            _preferences.SaveSettings();
        }
Exemplo n.º 2
0
        private bool ExecutePlay(int contextHandle, int startMillisecond, int endMillisecond, bool logAudio)
        {
            ExecutionContext context;

            if (!_registeredContexts.TryGetValue(contextHandle, out context))
            {
                return(false);
            }
            if (!(((context.SynchronousEngineInstance != null) && (context.Object != null)) && context.Object.CanBePlayed))
            {
                return(false);
            }
            if (context.SynchronousEngineInstance.IsRunning)
            {
                return(false);
            }
            if (!context.SynchronousEngineInstance.IsPaused)
            {
                try {
                    context.SynchronousEngineInstance.Initialize(context.Object);
                }
                catch (Exception exception) {
                    LogError("ExecutePlay", exception);
                    return(false);
                }
            }
            var str = context.SynchronousEngineInstance.CurrentObject.Key.ToString(CultureInfo.InvariantCulture);

            Host.Communication["KeyInterceptor_" + str]   = context.KeyInterceptor;
            Host.Communication["ExecutionContext_" + str] = context;
            var flag         = context.SynchronousEngineInstance.Play(startMillisecond, endMillisecond, logAudio);
            var saveSettings = false;

            foreach (var form in context.OutputPlugInForms)
            {
                form.BringToFront();

                if (_preferences.CreateIfMissing("SavePlugInDialogPositions", form.Name + ".x", 0) |
                    _preferences.CreateIfMissing("SavePlugInDialogPositions", form.Name + ".y", 0))
                {
                    saveSettings = true;
                }
                form.Location = new Point(_preferences.GetInteger(form.Name + ".x"), _preferences.GetInteger(form.Name + ".y"));
            }

            if (saveSettings)
            {
                _preferences.SaveSettings();
            }

            return(flag);
        }
Exemplo n.º 3
0
        /// <summary>
        /// If we get a good version back, show the user their options<br/>
        /// 1) There's a new version<br/>
        /// 2) They're up to date<br/>
        /// 3) Communication or file error<br/>
        /// 4) Nothing if we're the version is ignored or if they are up to date and in startup
        /// </summary>
        private void CheckForUpdate()
        {
            Log("Check for update start");
            _newVersion = GetAvailableVersion();
            var thisVersion = Utils.GetVersion(GetType());

            Log("This version " + thisVersion);
            if (_newVersion != ErrorIndicatorVersion)
            {
                _preferences.SetString(LastChecked, DateTime.Parse(DateTime.Now.ToString("s"), CultureInfo.InvariantCulture).ToString("s"));
                _preferences.SaveSettings();
                if (_newVersion == _preferences.GetString(SkippedVersion))
                {
                    Log("Version skipped: " + _newVersion);
                    DialogResult = DialogResult.No;
                    return;
                }
                if (new Version(_newVersion) > new Version(thisVersion))
                {
                    Log(string.Format("current: {1}, new: {0}", _newVersion, thisVersion));
                    SetupDialogShowHide(true);
                    pbDownload.Visible = false;
                    Text           = "New update available";
                    lblPrompt.Text =
                        string.Format(
                            "Version {0} of {1} is available would you like to download and install this version?\n\nYou are running version {2}",
                            _newVersion, Vendor.ProductName, thisVersion);
                }
                else if (!_isInStartup)
                {
                    Log("Up to date NOT in startup");
                    SetupDialogForOkay();
                    Text           = "You're up to date";
                    lblPrompt.Text = string.Format("You have version {0}, which is the latest version of {1} ", thisVersion, Vendor.ProductName);
                }
                else
                {
                    Log("Up to date in startup");
                    DialogResult = DialogResult.No;
                }
            }
            else
            {
                Log("Communication/firewall error");
                SetupDialogForOkay();
                Text           = "OOPS!";
                lblPrompt.Text = string.Format("Could not reach the {0} web site, check your internet connection or firewall.", Vendor.ProductName);
            }
        }
Exemplo n.º 4
0
 private void buttonSet_Click(object sender, EventArgs e)
 {
     _preferences.SetInteger("SoundDevice", comboBoxDevice.SelectedIndex, 0);
     _preferences.SaveSettings();
     buttonSet.Enabled = false;
     MessageBox.Show(Resources.RestartForChange, Vendor.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
 }
Exemplo n.º 5
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     WritePreferences(tabControl.SelectedIndex);
     _preferences.SaveSettings();
 }