Exemplo n.º 1
0
        private async void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            TaskPaneDict    = new Dictionary <PowerPoint.DocumentWindow, CustomTaskPane>();
            Rigel.PluginDir = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, "InstallPath");
            Rigel.UserName  = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, "UserName");
            Rigel.UserToken = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, "UserToken");

            /*if(String.IsNullOrEmpty(Rigel.PluginDir))
             * {
             *  PromptBox.Error("没有找到安装目录!");
             * }*/
            //Rigel.PluginDir += "/";
            Rigel.InitWorkConfig();
            FormShower       = new FormMgr(new IntPtr(this.Application.HWND));
            App.ResourceType = ResourceType.None;
            this.Application.WindowActivate += WindowActivate_Event;

            Rigel.PluginVersion = "1.0.0.25";
            var aaaa = System.Reflection.Assembly.GetExecutingAssembly();

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                try {
                    ApplicationDeployment applicationDeployment = ApplicationDeployment.CurrentDeployment;
                    Logger.LogInfo("UpdatedVersion:" + applicationDeployment.UpdatedVersion.ToString());
                    Logger.LogInfo("CurrentVersion" + applicationDeployment.CurrentVersion.ToString());
                    Rigel.PluginVersion = applicationDeployment.CurrentVersion.ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            VSTOUpdater.CheckUpdate().Wait();


            /*if (VSTOUpdater.NeedUpdate)
             * {
             *  UpdateWidget updateWidget = new UpdateWidget();
             *  updateWidget.setNeedUpdate(VSTOUpdater.NeedUpdate);
             *  updateWidget.setVersion(Rigel.PluginVersion, VSTOUpdater.ServerVersion);
             *  VSTOUpdater.UpdateLog.TryGetValue("slogan", out string slogan);
             *  VSTOUpdater.UpdateLog.TryGetValue("content", out string content);
             *  updateWidget.setInfo(slogan, content);
             *  DialogResult result = ThisAddIn.FormShower.ShowDialog(updateWidget);
             *  if (result == DialogResult.OK)
             *  {
             *      VSTOUpdater.Update(); ;
             *  }
             * }*/
        }
Exemplo n.º 2
0
        private async Task <bool> LoadUserInfo()
        {
            String strUserName = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserName);

            if (!String.IsNullOrEmpty(strUserName))
            {
                String strUserToken = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserToken);
                if (await RequestHandle.TokenValidity(strUserToken))
                {
                    Rigel.UserID       = strUserName;
                    Rigel.UserName     = strUserName;
                    Rigel.UserToken    = strUserToken;
                    button_login.Label = Rigel.UserName;
                    ResetButtonEnable(true);
                    return(true);
                }
                return(false);
            }
            return(false);
        }