Ejemplo n.º 1
0
        public static void Start()
        {
            // |-------[ Folders & Files ]-------| //
            if (Reference.Folders.Count() > 0)
            {
                // Create folders
                foreach (String _Folder in Reference.Folders)
                {
                    if (!String.IsNullOrEmpty(_Folder))
                    {
                        Directory.CreateDirectory(_Folder);
                    }
                }
            }

            // IronPythonLib
            File.WriteAllBytes(Reference.IronModules, Resources.IronPythonLib);

            // |-------[ Settings ]-------| //
            Settings.Init();
            // |-------[ Languages ]-------| //
            Langs.Init();

            // |-------[ Visual ]-------| //
            SkinManager.ApplySkin();

            // |-------[ Updates ]-------| //

            // Delete temporary files
            Update.DeleteTemporaryFiles();

            // Update is available
            if (Reference.JsonSettings.Check_for_updates && Update.UpdateAvaible())
            {
                // Ask user to install it, and then install
                if (Update.InstallUpdate(true))
                {
                    // User install the update, stop execution
                    return;
                }
            }

            // |-------[ Views ]-------| //
            Reference.MainWindow = new Main();

            // |-------[ Recognition ]-------| //
            Synthesizer.Init();
            SpeechRecognition.Init();

            // |-------[ Profiles ]-------| //
            Profiles.Init();

            // Hide SplashScreen
            Application.Current.MainWindow.Hide();
            // Show MainWindow
            Reference.MainWindow.Show();

            Utils.Log(Langs.Get("wolfy_loaded"));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks if a new update is available
        /// Returns true if this is the case, otherwise returns false
        /// </summary>
        public static bool UpdateAvaible()
        {
            try {
                // Fetch update
                JsonUpdate _Update = FetchUpdate();

                // Check if versions are not equal
                if (Reference.AppVersion != _Update.Latest_version)
                {
                    return(true);
                }
            } catch {
                MessageBox.Show(Langs.Get("update_check_error"), Reference.AppName, MessageBoxButton.OK, MessageBoxImage.Error);
            }

            // Return
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Installs the latest update, (make sure to check if an update is available!)
        /// If _AskUser is true, first ask the user if he wants to install it or not
        /// Returns true if the update will be installed, otherwise returns false
        /// </summary>
        public static bool InstallUpdate(bool _AskUser)
        {
            // User don't want to install
            if (_AskUser && MessageBox.Show(Langs.Get("update_request"), Reference.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
            {
                return(false);
            }

            // Fetch update
            JsonUpdate _Update = FetchUpdate();

            // Else install the update

            // Hide splashscreen
            App.Current.MainWindow.Hide();

            // Show update window
            Windows.Update _UpdateWindow = new Windows.Update(_Update.Latest_link);
            _UpdateWindow.ShowDialog();

            // Return
            return(true);
        }