示例#1
0
        private async void BVisibility_Click(object sender, EventArgs e)
        {
            using (frmSINnerVisibility visfrm = new frmSINnerVisibility())
            {
                using (await CursorWait.NewAsync(this, true))
                {
                    if (myUC.MyCE.MySINnerFile.SiNnerMetaData.Visibility.UserRights.Count == 0)
                    {
                        SinnersClient client = StaticUtils.GetClient();
                        if (myUC.MyCE.MySINnerFile.Id != null)
                        {
                            ResultSinnerGetSINnerVisibilityById res =
                                await client.GetSINnerVisibilityByIdAsync(
                                    myUC.MyCE.MySINnerFile.Id.Value);

                            await Backend.Utils.ShowErrorResponseFormAsync(res);

                            if (res.CallSuccess)
                            {
                                myUC.MyCE.MySINnerFile.SiNnerMetaData.Visibility.UserRights = res.UserRights;
                            }
                        }
                    }
                }

                visfrm.MyVisibility = myUC.MyCE.MySINnerFile.SiNnerMetaData.Visibility;
                DialogResult result = visfrm.ShowDialog(this);
                if (result == DialogResult.OK)
                {
                    myUC.MyCE.MySINnerFile.SiNnerMetaData.Visibility = visfrm.MyVisibility;
                }
            }
        }
示例#2
0
 private async void SkillsTabUserControl_Load(object sender, EventArgs e)
 {
     if (_objCharacter != null)
     {
         return;
     }
     using (await CursorWait.NewAsync(this))
         await RealLoad();
 }
示例#3
0
 private async void bUpload_Click(object sender, EventArgs e)
 {
     using (await CursorWait.NewAsync(this, true))
     {
         try
         {
             if (bUpload.Text.Contains("Upload"))
             {
                 lUploadStatus.Text = "Uploading";
                 await myUC.MyCE.Upload();
             }
             else
             {
                 lUploadStatus.Text = "Removing";
                 await myUC.RemoveSINnerAsync();
             }
         }
         catch (Exception exception)
         {
             Program.ShowMessageBox(exception.Message);
         }
     }
     await CheckSINnerStatus();
 }
示例#4
0
        public async Task <bool> CheckSINnerStatus()
        {
            try
            {
                if (myUC?.MyCE?.MySINnerFile?.Id == null || myUC.MyCE.MySINnerFile.Id == Guid.Empty)
                {
                    await bUpload.DoThreadSafeAsync(x => x.Text = "SINless Character/Error");

                    return(false);
                }

                using (await CursorWait.NewAsync(this, true))
                {
                    SinnersClient client = StaticUtils.GetClient();
                    ResultSinnerGetSINnerGroupFromSINerById response = await client.GetSINnerGroupFromSINerByIdAsync(myUC.MyCE.MySINnerFile.Id.Value);

                    SINnerGroup objMySiNnerGroup = response.MySINnerGroup;

                    await PluginHandler.MainForm.DoThreadSafeAsync(() =>
                    {
                        if (objMySiNnerGroup != null)
                        {
                            myUC.MyCE.MySINnerFile.MyGroup = objMySiNnerGroup;
                            bUpload.Text         = "Remove from SINners";
                            bGroupSearch.Enabled = true;
                            lUploadStatus.Text   = "Online";
                            bUpload.Enabled      = true;
                        }
                        else
                        {
                            myUC.MyCE.MySINnerFile.MyGroup = null;
                            lUploadStatus.Text             = "Not Online";
                            bGroupSearch.Enabled           = false;
                            bGroupSearch.SetToolTip(
                                "SINner needs to be uploaded first, before he/she can join a group.");
                            bUpload.Enabled = true;
                            bUpload.Text    = "Upload";
                        }
                        //else if (eResponseStatus == HttpStatusCode.NoContent)
                        //{
                        //    myUC.MyCE.MySINnerFile.MyGroup = null;
                        //    lUploadStatus.Text = "Status Code: " + eResponseStatus;
                        //    bGroupSearch.Enabled = true;
                        //    bGroupSearch.SetToolTip(
                        //        "SINner does not belong to a group.");
                        //    bUpload.Text = "Remove from SINners";
                        //    lUploadStatus.Text = "Online";
                        //    bUpload.Enabled = true;
                        //}
                        cbTagCustom.Enabled        = false;
                        TagValueCustomName.Enabled = false;
                    });

                    await this.DoThreadSafeAsync(UpdateTags);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                await bUpload.DoThreadSafeAsync(x => x.Text = "Unknown Status");

                return(false);
            }
            return(true);
        }