Beispiel #1
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CheckForUpdates(Preference2.GetScreen(_preferences.GetString("PrimaryDisplay")), false))
     {
         Close();
     }
 }
Beispiel #2
0
        public VixenPlusForm(IEnumerable <string> args)
        {
            var startupArgs = args as IList <string> ?? args.ToList();

            SetDataPath();
            Ensure(Paths.DataPath);
            Ensure(Paths.SequencePath);
            Ensure(Paths.ImportExportPath);
            Ensure(Paths.AudioPath);
            Ensure(Paths.ProfilePath);
            Ensure(Paths.SupportingFilesPath);
            Ensure(Paths.ProfileGeneration);
            Ensure(Paths.MapperPath);
            Ensure(Paths.NutcrackerDataPath);
            Ensure(Paths.RoutinePath);
            Ensure(Paths.CurveLibraryPath);
            _preferences = Preference2.GetInstance();
            PrepareUpdateSupportFiles();
            using (var splash = new Splash()) {
                var screen = Preference2.GetScreen(_preferences.GetString("PrimaryDisplay"));
                splash.FadeIn(screen);

                if (CheckForUpdates(screen, true))
                {
                    Environment.Exit(0);
                }

                InitializeComponent();
                Icon = common.Resources.VixenPlus;
                SetVendorData();
                _registeredFileTypes               = new Dictionary <string, IUIPlugIn>();
                _preferences.PreferenceChange     += PreferencesPreferenceChange;
                Interfaces.Available["ISystem"]    = this;
                Interfaces.Available["IExecution"] = new ExecutionImpl(new Host(this));
                _historyItemClick = HistoryItemClick;
                LoadHistory();
                var loadableData = new LoadableData();
                loadableData.LoadFromXml(_preferences.XmlDoc.DocumentElement);
                LoadUIPlugins();
                Cursor = Cursors.WaitCursor;
                try {
                    foreach (var sequence in startupArgs.Where(File.Exists))
                    {
                        OpenSequence(sequence);
                    }
                }
                finally {
                    Cursor = Cursors.Default;
                }
                SetShutdownTime(_preferences.GetString("ShutdownTime"));

                splash.FadeOut();
                Left = screen.Bounds.Left;
                Top  = screen.Bounds.Top;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Returns if it is time to run the check for update routine<br/>
        /// Short Circuit for On Startup and Never
        /// </summary>
        /// <returns>bool representing if it is time to check for an update</returns>
        public bool IsTimeToCheckForUpdate()
        {
            Log("IsTimeToCheckForUpdate Start");
            const string onStartup = "On Statup";
            const string never     = "Never";
            const string daily     = "Daily";
            const string weekly    = "Weekly";
            const string monthly   = "Monthly";
            const string quarterly = "Quarterly";
            const string annually  = "Annually";

            // First short circuit
            var freq = _preferences.GetString(CheckFrequency);

            if (freq == never || freq == onStartup)
            {
                Log("IsTimeToCheckForUpdate short circuit: " + (freq == onStartup));
                return(freq == onStartup);
            }

            // Next, get how many hours we need to wait until updating again. Default to On Startup.
            var waitHours = 0.0;

            switch (freq)
            {
            case daily:
                waitHours = Utils.UpdateDaily;
                break;

            case weekly:
                waitHours = Utils.UpdateWeekly;
                break;

            case monthly:
                waitHours = Utils.UpdateMonthly;
                break;

            case quarterly:
                waitHours = Utils.UpdateQuarterly;
                break;

            case annually:
                waitHours = Utils.UpdateAnnually;
                break;
            }

            // Finally, calculate elapsed time in seconds and return result
            var lastChecked = DateTime.Parse(_preferences.GetString(LastChecked), CultureInfo.InvariantCulture);
            var hours       = (DateTime.Now - lastChecked).TotalHours;

            Log("IsTimeToCheckForUpdate normal: " + (hours >= waitHours));
            Log("Elapsed hours since last check: " + hours);
            return(hours >= waitHours);
        }
Beispiel #4
0
 public EventSequence(Preference2 preferences) : this()
 {
     _fullChannels = new List <Channel>();
     Channels      = new List <Channel>();
     PlugInData    = new SetupData();
     Extensions    = new SequenceExtensions();
     if (preferences != null)
     {
         _eventPeriod = preferences.GetInteger("EventPeriod");
         MinimumLevel = (byte)preferences.GetInteger("MinimumLevel");
         MaximumLevel = (byte)preferences.GetInteger("MaximumLevel");
         var profileName = preferences.GetString("DefaultProfile");
         if (profileName.Length > 0)
         {
             AttachToProfile(profileName);
         }
         AudioDeviceIndex = preferences.GetInteger("DefaultSequenceAudioDevice");
     }
     else
     {
         _eventPeriod     = 100;
         MinimumLevel     = 0;
         MaximumLevel     = 255;
         AudioDeviceIndex = -1;
     }
     Time = 60000;
 }
        private void InitializeClass()
        {
            Icon = common.Resources.VixenPlus;
            openFileDialog.InitialDirectory = Paths.SequencePath;
            tabControl.SelectedIndex        = 0;
            PopulateProfileList();
            var str = _preferences.GetString("DefaultProfile");

            if (str.Length > 0)
            {
                comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.IndexOf(str);
            }
            UpdateExplanations(0);
        }
Beispiel #6
0
        private void PreferencesPreferenceChange(string preferenceName)
        {
            switch (preferenceName)
            {
            case "EventPeriod":
                if (_preferences.GetInteger("EventPeriod") < Vendor.MinimumEventPeriod)
                {
                    _preferences.SetInteger("EventPeriod", Vendor.MinimumEventPeriod);
                    MessageBox.Show(String.Format(Resources.VixenPlusForm_EventPeriodMin, Vendor.MinimumEventPeriod), Vendor.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                break;

            case "ShutdownTime":
                SetShutdownTime(_preferences.GetString("ShutdownTime"));
                break;
            }
        }
Beispiel #7
0
 public int RequestContext(bool suppressAsynchronousContext, bool suppressSynchronousContext, Form keyInterceptor)
 {
     try {
         var num     = ((int)DateTime.Now.ToBinary()) + _registeredContexts.Count;
         var context = new ExecutionContext
         {
             SuppressAsynchronousContext = suppressAsynchronousContext, SuppressSynchronousContext = suppressSynchronousContext
         };
         var integer = _preferences.GetInteger("SoundDevice");
         context.SynchronousEngineInstance  = context.SuppressSynchronousContext ? null : new Engine8(_host, integer);
         context.AsynchronousEngineInstance = context.SuppressAsynchronousContext
             ? null : new Engine8(Engine8.EngineMode.Asynchronous, _host, integer);
         context.LocalRequestor = RequestorIsLocal(new StackTrace().GetFrame(1));
         context.Object         = null;
         context.KeyInterceptor = keyInterceptor;
         if (!context.SuppressAsynchronousContext)
         {
             byte[][]  mask;
             SetupData plugInData;
             var       str     = _preferences.GetString("AsynchronousData");
             var       str2    = ((str != "Default") && (str != "Sync")) ? str : _preferences.GetString("DefaultProfile");
             Profile   profile = null;
             if (str2.Length > 0)
             {
                 try {
                     var nativeIO = FileIOHelper.GetNativeHelper();
                     profile = nativeIO.OpenProfile(Path.Combine(Paths.ProfilePath, str2 + ".pro"));
                     profile.Freeze();
                 }
                 catch {
                     LogError("RequestContext", "Error loading profile " + str2);
                 }
             }
             if (profile == null)
             {
                 if (str == "Default")
                 {
                     LogError("RequestContext",
                              "Preference set to use default profile for asynchronous execution, but no default profile exists.");
                 }
                 mask       = null;
                 plugInData = null;
             }
             else
             {
                 mask           = profile.Mask;
                 plugInData     = profile.PlugInData;
                 context.Object = profile;
             }
             if (context.Object != null)
             {
                 context.Object.Mask = mask;
                 if (plugInData != null)
                 {
                     context.Object.PlugInData.ReplaceRoot(plugInData.RootNode);
                 }
                 AsyncInit(context);
             }
         }
         _registeredContexts[num] = context;
         return(num);
     }
     catch (Exception exception) {
         LogError("RequestContext", exception);
         return(0);
     }
 }
Beispiel #8
0
        private void ReadGeneralNodes()
        {
            textBoxMouseWheelVertical.Text   = _preferences.GetString("MouseWheelVerticalDelta");
            textBoxMouseWheelHorizontal.Text = _preferences.GetString("MouseWheelHorizontalDelta");
            var s = _preferences.GetString("ShutdownTime");

            if (s != string.Empty)
            {
                dateTimePickerAutoShutdownTime.Checked = true;
                dateTimePickerAutoShutdownTime.Value   = DateTime.Parse(s);
            }
            cbUpdateFrequency.SelectedItem   = _preferences.GetString("AutoUpdateCheckFreq");
            numericUpDownHistoryImages.Value = _preferences.GetInteger("HistoryImages");
            nudRecentFiles.Value             = _preferences.GetInteger("RecentFiles");
            cbToolbarAutoSave.Checked        = _preferences.GetBoolean("AutoSaveToolbars");
        }
Beispiel #9
0
        public VixenPlusForm(string[] args)
        {
            SetDataPath();
            Ensure(Paths.DataPath);
            Ensure(Paths.SequencePath);
            Ensure(Paths.ImportExportPath);
            Ensure(Paths.AudioPath);
            Ensure(Paths.ProfilePath);
            Ensure(Paths.SupportingFilesPath);
            Ensure(Paths.ProfileGeneration);
            Ensure(Paths.MapperPath);
            Ensure(Paths.NutcrackerDataPath);
            Ensure(Paths.RoutinePath);
            Ensure(Paths.CurveLibraryPath);
            _preferences = Preference2.GetInstance();
            //PrepareUpdateSupportFiles();
            using (var splash = new Splash()) {
                var screen = Preference2.GetScreen(_preferences.GetString("PrimaryDisplay"));
                splash.FadeIn(screen);

                /*
                 * if (CheckForUpdates(screen, true)) {
                 *  Environment.Exit(0);
                 * }
                 */

                InitializeComponent();
                Icon = common.Resources.VixenPlus;
                _registeredFileTypes               = new Dictionary <string, IUIPlugIn>();
                _preferences.PreferenceChange     += PreferencesPreferenceChange;
                Interfaces.Available["ISystem"]    = this;
                Interfaces.Available["IExecution"] = new ExecutionImpl(new Host(this));
                _historyItemClick = HistoryItemClick;
                LoadHistory();
                var loadableData = new LoadableData();
                loadableData.LoadFromXml(_preferences.XmlDoc.DocumentElement);
                LoadUIPlugins();
                Cursor = Cursors.WaitCursor;

                CommandLineOptions options = AutoPlay.ParseCommandLine(args);

                try {
                    if (!options.Play)
                    {
                        foreach (var sequence in options.Sequences.Where(File.Exists))
                        {
                            OpenSequence(sequence);
                        }
                    }
                }
                finally {
                    Cursor = Cursors.Default;
                }

                SetShutdownTime(_preferences.GetString("ShutdownTime"));

                splash.FadeOut();
                Left = screen.Bounds.Left;
                Top  = screen.Bounds.Top;

                helpToolStripMenuItem.Visible = false; //No need for a help menu, miht add back if I publish to everyone

                AutoPlay.Begin(options, this);
            }
        }