private async void mnuNPCs_Click(object sender, EventArgs ea) { try { using (new CursorWait(true, PluginHandler.MainForm)) { frmSINnerGroupSearch frmSearch = new frmSINnerGroupSearch(null, null); frmSearch.Show(PluginHandler.MainForm); //MyTreeNodes2Add.Clear(); //Func<Task<HttpOperationResponse<SINSearchGroupResult>>> myGetNPCs = async () => //{ // var client = await StaticUtils.GetClient(); // var res = await client.GetPublicGroupWithHttpMessagesAsync("NPC", GlobalOptions.Language, null, new CancellationToken()); // return res; //}; //var nodelist = await ChummerHub.Client.Backend.Utils.GetCharacterRosterTreeNode(true, myGetNPCs); //foreach (var node in nodelist) //{ // MyTreeNodes2Add.AddOrUpdate(node.Name, node, (key, oldValue) => node); //} //PluginHandler.MainForm.CharacterRoster.LoadCharacters(false, false, false, true); //PluginHandler.MainForm.CharacterRoster.BringToFront(); } } catch (Microsoft.Rest.SerializationException e) { if (e.Content.Contains("Log in - ChummerHub")) { TreeNode node = new TreeNode("Online, but not logged in!") { ToolTipText = "Please log in (Options -> Plugins -> Sinners (Cloud) -> Login", Tag = e }; //return new List<TreeNode>() { node }; } else { TreeNode node = new TreeNode("Error: " + e.Message) { ToolTipText = e.ToString(), Tag = e }; //return new List<TreeNode>() { node }; } } catch (Exception e) { TreeNode node = new TreeNode("SINners Error: please log in") { ToolTipText = e.ToString(), Tag = e }; //return new List<TreeNode>() { node }; } }
private async void mnuSINners_Click(object sender, EventArgs ea) { try { using (new CursorWait(true, PluginHandler.MainForm)) { frmSINnerGroupSearch frmSearch = new frmSINnerGroupSearch(null, null); frmSearch.TopMost = true; frmSearch.Show(PluginHandler.MainForm); } } catch (Microsoft.Rest.SerializationException e) { if (e.Content.Contains("Log in - ChummerHub")) { TreeNode node = new TreeNode("Online, but not logged in!") { ToolTipText = "Please log in (Options -> Plugins -> Sinners (Cloud) -> Login", Tag = e }; Log.Warn("Online, but not logged in!"); } else { Log.Warn(e); TreeNode node = new TreeNode("Error: " + e.Message) { ToolTipText = e.ToString(), Tag = e }; } } catch (Exception e) { Log.Warn(e); TreeNode node = new TreeNode("SINners Error: please log in") { ToolTipText = e.ToString(), Tag = e }; } }