Example #1
0
        private static void GetUpdates(Action openWindow, string getUpdatesUrl)
        {
            if (string.IsNullOrEmpty(getUpdatesUrl))
            {
                return;
            }

            BackgroundTaskRunner.StartBackgroundTask(HttpRequestManager.SendRequest(getUpdatesUrl, (www, textResult) =>
            {
                try
                {
                    var update = UpdateData.CreateFromJSON(textResult);
                    if (update != null)
                    {
                        ProductPreferenceBase.CreateDefaultLastUpdateText().SetEditorPersistedValue(update.Text);
                        if (!string.IsNullOrWhiteSpace(update.Text))
                        {
                            openWindow();
                        }
                    }
                }
                catch
                {
                    //don't show error
                }
            }));
        }
        private void EnsureInitialized()
        {
            if (_isInitialized)
            {
                return;
            }

            EnsureStylesInitialized();
            _startupStartupShowMode = (ProductPreferenceBase.StartupShowMode)EditorPrefs.GetInt(ShowAtStartupPreferenceKey, (int)ProductPreferenceBase.StartupShowMode.Always);
            LastUpdateText          = ProductPreferenceBase.CreateDefaultLastUpdateText().GetEditorPersistedValueOrDefault() as string;

            _isInitialized = true;
        }