private async void BVisibility_Click(object sender, EventArgs e) { using (frmSINnerVisibility visfrm = new frmSINnerVisibility()) { using (CursorWait.New(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; } } }
private void SkillsTabUserControl_Load(object sender, EventArgs e) { if (_objCharacter != null) { return; } using (CursorWait.New(this)) RealLoad(); }
private SinnersClient GetCookieContainer() { try { using (CursorWait.New(this, true)) { Settings.Default.CookieData = null; Settings.Default.Save(); CookieCollection cookies = StaticUtils.AuthorizationCookieContainer?.GetCookies(new Uri(Settings.Default .SINnerUrl)); return(StaticUtils.GetClient(true)); } } catch (Exception ex) { Log.Warn(ex); } return(null); }
private async void bUpload_Click(object sender, EventArgs e) { using (CursorWait.New(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(); }
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 (CursorWait.New(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); }
private void LoadSections() { using (CursorWait.New(this)) { List <string> lstSectionStrings = null; XmlNode xmlNode = _objDataDoc.SelectSingleNode("/chummer/chummer[@file = " + cboFile.Text.CleanXPath() + "]"); if (xmlNode != null) { lstSectionStrings = new List <string>(xmlNode.ChildNodes.Count); foreach (XmlNode childNode in xmlNode.ChildNodes) { lstSectionStrings.Add(childNode.Name); } lstSectionStrings.Sort(); if (lstSectionStrings.Count > 0) { lstSectionStrings.Insert(0, "[Show All Sections]"); } } string strOldSelected = cboSection.SelectedValue?.ToString() ?? string.Empty; _blnLoading = true; try { cboSection.BeginUpdate(); try { cboSection.Items.Clear(); if (lstSectionStrings != null) { foreach (string strSection in lstSectionStrings) { cboSection.Items.Add(strSection); } } } finally { cboSection.EndUpdate(); } } finally { _blnLoading = false; } if (string.IsNullOrEmpty(strOldSelected)) { cboSection.SelectedValue = -1; } else { cboSection.SelectedValue = strOldSelected; if (cboSection.SelectedIndex == -1 && cboSection.Items.Count > 0) { cboSection.SelectedIndex = 0; } } } }
private void btnSearch_Click(object sender, EventArgs e) { using (CursorWait.New(this)) { pbTranslateProgressBar.Value = 0; string strNeedle = txtSearch.Text; int rowCount = dgvSection.RowCount; int columnCount = dgvSection.ColumnCount; pbTranslateProgressBar.Step = 1; pbTranslateProgressBar.Maximum = rowCount * columnCount; int rowIndex = dgvSection.SelectedCells.Count > 0 ? dgvSection.SelectedCells[0].RowIndex : 0; try { for (int i = rowIndex; i < rowCount; ++i) { DataGridViewCellCollection objCurrentRowCells = dgvSection.Rows[i].Cells; for (int j = 0; j < columnCount; j++) { DataGridViewCell objCurrentCell = objCurrentRowCells[j]; if (objCurrentCell.Value.ToString() .IndexOf(strNeedle, 0, StringComparison.CurrentCultureIgnoreCase) != -1) { dgvSection.ClearSelection(); objCurrentCell.Selected = true; dgvSection.FirstDisplayedScrollingRowIndex = i; dgvSection.Select(); return; } pbTranslateProgressBar.PerformStep(); } } for (int i = 0; i < rowIndex; ++i) { DataGridViewCellCollection objCurrentRowCells = dgvSection.Rows[i].Cells; for (int j = 0; j < columnCount; j++) { DataGridViewCell objCurrentCell = objCurrentRowCells[j]; if (objCurrentCell.Value.ToString() .IndexOf(strNeedle, 0, StringComparison.CurrentCultureIgnoreCase) != -1) { dgvSection.ClearSelection(); objCurrentCell.Selected = true; dgvSection.FirstDisplayedScrollingRowIndex = i; dgvSection.Select(); return; } pbTranslateProgressBar.PerformStep(); } } } finally { pbTranslateProgressBar.Value = 0; } MessageBox.Show("Search text was not found."); } }