Example #1
0
        private AppController()
        {
            Current = this;

            // the authorization is done using an embedded Internet Explorer control - which is in quirks mode by default
            // so the library has a method to tell Windows this app is fine to use a real browser mode (you can choose which one - IE 9 in this case)
            Authorization.registerAppInRegistry(Authorization.registerBrowserEmulationValue.IE9Always, alsoCreateVshostEntry: true);

            #region Check for update and upgrade settings if so
            try
            {
                if (!Properties.Settings.Default.settings_updated)
                {
                    Properties.Settings.Default.Upgrade();
                    Properties.Settings.Default.settings_updated = true;
                }
            }
            catch
            {
                try
                {
                    Properties.Settings.Default.Reset();
                }
                catch { }
            }
            #endregion

            // note: you must not store the access_token in plain text. Add an encryption here!
            if (string.IsNullOrWhiteSpace(Properties.Settings.Default.access_token))
            {
                authorize_account();
            }
            else
            {
                // the access token should be stored encrypted!
                // it is not here in this example...
                access_token = Properties.Settings.Default.access_token;
                check_access_token();
            }
        }
Example #2
0
 public void Application_Startup(object sender, StartupEventArgs e)
 {
     AppController.Start();
 }