/// <summary> /// Change title /// </summary> private async void button_ChangeTitle_Click(object sender, EventArgs e) { if (listBox_Shares.SelectedItem is Gett.Sharing.GettShare) { var share = (Gett.Sharing.GettShare)listBox_Shares.SelectedItem; var changeTitleShare = new NewShareForm { Share = share }; if (changeTitleShare.ShowDialog() == DialogResult.OK) { try { UseWaitCursor = true; await share.SetTitleAsync(changeTitleShare.Title); button_RefreshShares.PerformClick(); } catch (Exception ex) { MessageBox.Show(@"Failed to change title for share at Ge.tt" + Environment.NewLine + @"Exception of type " + ex.GetType() + Environment.NewLine + ex.Message); } finally { UseWaitCursor = false; } } } }
/// <summary> /// Create new share /// </summary> private async void button_CreateShare_Click(object sender, EventArgs e) { var newShare = new NewShareForm(); if (newShare.ShowDialog() == DialogResult.OK) { try { UseWaitCursor = true; Gett.Sharing.GettShare share = await _gettUser.Shares.CreateShareAsync(newShare.Title); listBox_Shares.Items.Add(share); } catch (Exception ex) { MessageBox.Show(@"Failed to create new share at Ge.tt" + Environment.NewLine + @"Exception of type " + ex.GetType() + Environment.NewLine + ex.Message); } finally { UseWaitCursor = false; } } }