예제 #1
0
        private void refreshAccountStatus()
        {
            bool linked = Properties.Settings.Default.account_authed;

            lblLinked.InvokeIfRequired(() => {
                lblLinked.Text      = linked ? "Linked!" : "Not Linked!";
                lblLinked.ForeColor = linked ? Color.Green : Color.Red;
            });


            Imgur.Account acc = new Imgur.Account();
            acc.url = "none";
            if (linked)
            {
                acc = Imgur.accountInfo(Properties.Settings.Default.account_id);
                if (!acc.success)
                {
                    Globals.ErrorLog("Imgur.accountInfo() Failed from refreshAccountStatus() : " + acc.ex.Message, false);
                    acc.url = "Failed To Retrieve Username";
                    if (acc.ex.Message.Contains("403")) //Forbidden
                    {
                        UnlinkAccount();
                        Notification.DisplayBubbleMessage(5, "InfiniPad", "InfiniPad lost access to your Imgur account. Please relink it to continue usage.");
                        acc.url = "none";
                    }
                }
            }

            lblUsername.InvokeIfRequired(() =>
            {
                lblUsername.Text = linked ? "Signed in as " + acc.url : "";
            });

            lblAccountID.InvokeIfRequired(() =>
            {
                lblAccountID.Text = linked ? "ID: " + acc.id : "";
            });

            btnUnlink.InvokeIfRequired(() =>
            {
                btnUnlink.Visible = Properties.Settings.Default.account_authed;
            });
        }
예제 #2
0
파일: Settings.cs 프로젝트: Enoz/InfiniPad
        private void refreshAccountStatus()
        {

            bool linked = Properties.Settings.Default.account_authed;
            lblLinked.InvokeIfRequired(() => {
                lblLinked.Text = linked ? "Linked!" : "Not Linked!";
                lblLinked.ForeColor = linked ? Color.Green : Color.Red;
            });


            Imgur.Account acc = new Imgur.Account();
            acc.url = "none";
            if (linked)
            {
                acc = Imgur.accountInfo(Properties.Settings.Default.account_id);
                if (!acc.success)
                {
                    Globals.ErrorLog("Imgur.accountInfo() Failed from refreshAccountStatus() : " + acc.ex.Message, false);
                    acc.url = "Failed To Retrieve Username";
                }
            }
                
            lblUsername.InvokeIfRequired(() =>
            {
                lblUsername.Text = linked ? "Signed in as " + acc.url : "";
            });

            lblAccountID.InvokeIfRequired(() =>
            {
                lblAccountID.Text = linked ? "ID: " + acc.id : "";
            });

            btnUnlink.InvokeIfRequired(() =>
            {
                btnUnlink.Visible = Properties.Settings.Default.account_authed;
            });


        }