public wndClientOverload(StaticGroupManager gmGroupManager, StaticPinvokeLolClient lcg, Action <string> DisplayPopup) : this() { if (gmGroupManager != null && lcg != null && DisplayPopup != null) { this._gm = gmGroupManager; this._lcg = lcg; this._displayPopup = DisplayPopup; _gm.GroupsChanged += _groupManager_GroupsChanged; for (int i = 0; i < _gm.GroupCount; i++) { _gm.getGroup(i).NameChanged += _groupManager_ChampionList_NameChanged; } _lcg.OnLeagueClientReposition += OnLeagueClientReposition; _lcg.LolClientFocussed += _lcg_LolClientFocussed; _lcg.LolClientFocusLost += _lcg_LolClientFocusLost; _lcg.LolClientStateChanged += _lcg_LolClientStateChanged; } else { DisplayPopup("wndClientlay.xaml.cs has null parameters!"); } Redraw(); }
private void MyGroupManager_GroupsChanged(StaticGroupManager sender, GroupManagerEventArgs e) { if (e.eventOperation == GroupManagerEventOperation.Add) { e.operationItem.NameChanged += MyGroupManager_ChampionList_NameChanged; } DisplayGroups(); }
private string ChangeStaticGroupInfo(HttpContext context) { string strJsonResult = string.Empty; string userAccount = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); Guid transactionid = Guid.NewGuid(); string funname = "ChangeStaticGroupInfo"; try { do { string strAccesstoken = context.Request["accessToken"]; //判断AccessToken if (string.IsNullOrEmpty(strAccesstoken)) { error.Code = ErrorCode.TokenEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } AdminInfo admin = new AdminInfo(); if (!TokenManager.ValidateUserToken(transactionid, strAccesstoken, out admin, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } Stream str = context.Request.InputStream; // Find number of bytes in stream. Int32 strLen = Convert.ToInt32(str.Length); // Create a byte array. byte[] strArr = new byte[strLen]; // Read stream into byte array. str.Read(strArr, 0, strLen); string body = System.Text.Encoding.UTF8.GetString(strArr); GroupInfo info = JsonConvert.DeserializeObject <GroupInfo>(body); StaticGroupManager manager = new StaticGroupManager(ClientIP); manager.ChangeStaticGroupInfo(transactionid, admin, info, out strJsonResult); } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("StaticGroup.ashx调用接口ChangeStaticGroupInfo异常", context.Request.RawUrl, ex.ToString(), transactionid); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); } return(strJsonResult); }
public wndAddGroup(StaticGroupManager gm) : this() { if (gm != null) { this._gm = gm; } else { throw new ArgumentNullException(); } }
public wndRenameGroup(StaticGroupManager gm, string strGroupToRename) : this() { if (gm != null && strGroupToRename != null) { this._gm = gm; this._strGroupToRename = strGroupToRename; } else { throw new ArgumentNullException(); } }
private string GetStaticGroupList(HttpContext context) { string strJsonResult = string.Empty; string userAccount = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); Guid transactionid = Guid.NewGuid(); string funname = "GetStaticGroupList"; try { do { string strAccesstoken = context.Request["accessToken"]; //判断AccessToken if (string.IsNullOrEmpty(strAccesstoken)) { error.Code = ErrorCode.TokenEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } AdminInfo admin = new AdminInfo(); if (!TokenManager.ValidateUserToken(transactionid, strAccesstoken, out admin, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } userAccount = admin.UserAccount; string pagesizeStr = context.Request["PageSize"]; if (string.IsNullOrEmpty(pagesizeStr)) { error.Code = ErrorCode.PageSizeEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } int pagesize = 0; if (!Int32.TryParse(pagesizeStr, out pagesize)) { error.Code = ErrorCode.PageSizeIllegal; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } else { pagesize = Convert.ToInt32(pagesizeStr); } string curpageStr = context.Request["CurPage"]; if (string.IsNullOrEmpty(curpageStr)) { error.Code = ErrorCode.CurPageEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } int curpage = 0; if (!Int32.TryParse(curpageStr, out curpage)) { error.Code = ErrorCode.CurPageIllegal; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } else { curpage = Convert.ToInt32(curpageStr); } string searchstr = context.Request["Searchstr"]; StaticGroupManager manager = new StaticGroupManager(ClientIP); manager.GetStaticGroupList(transactionid, admin, curpage, pagesize, searchstr, out strJsonResult); } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("StaticGroup.ashx调用接口GetStaticGroupList异常", context.Request.RawUrl, ex.ToString(), transactionid); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); } return(strJsonResult); }
private void NewGroupManager() { MyGroupManager = StaticGroupManager.GetInstance(); }
private void _groupManager_GroupsChanged(StaticGroupManager sender, GroupManagerEventArgs e) { if (sender != null) { //Try to preserve checked checkboxes switch (e.eventOperation) { case GroupManagerEventOperation.Add: //Get index of new added item int newItemIndex = _gm.indexOf(e.operationItem.getName()); //Insert item here at the correct spot System.Windows.Controls.CheckBox chk = new System.Windows.Controls.CheckBox(); chk.Content = e.operationItem.getName(); chk.Checked += new RoutedEventHandler(CheckBox_CheckStateChanged); cboGroups.Items.Insert(newItemIndex, chk); break; case GroupManagerEventOperation.Remove: //Remove it here based on e known name for (int i = 0; i < cboGroups.Items.Count; i++) { CheckBox cb = (CheckBox)cboGroups.Items[i]; if (cb.Content.ToString() == e.operationItem.getName()) { cboGroups.Items.RemoveAt(i); break; } } break; case GroupManagerEventOperation.Reposition: //Reposition it here based on name //Get new position int newPosition = _gm.indexOf(e.operationItem.getName()); int oldPosition = -1; bool isChecked = false; //Find old position for (int i = 0; i < cboGroups.Items.Count; i++) { CheckBox cb = (CheckBox)cboGroups.Items[i]; if (cb.Content.ToString() == e.operationItem.getName()) { oldPosition = i; isChecked = cb.IsChecked.Value; cboGroups.Items.RemoveAt(i); break; } } //Make new checkbox at that index System.Windows.Controls.CheckBox chkReplace = new System.Windows.Controls.CheckBox(); chkReplace.Content = e.operationItem.getName(); chkReplace.IsChecked = isChecked; chkReplace.Checked += new RoutedEventHandler(CheckBox_CheckStateChanged); cboGroups.Items.Insert(newPosition, chkReplace); break; } cboGroups.UpdateLayout(); } }