private void CreateTagGroup(TagGroup newtg) { var findtg = DBContext.TagGroups.FirstOrDefault((g) => g.Name == newtg.Name && g.State == StateCode.Active); if (findtg != null) { WindowMgr.SendNotification("标签组不能重名", NotificationLevel.Warning); } else { try { DBContext.TagGroups.Add(newtg); DBContext.SaveChanges(); WindowMgr.SendNotification("成功创建标签组", NotificationLevel.Information); AddTagGroupNode(newtg); ShowFormGrid(false); } catch (Exception ex) { // TODO WindowMgr.SendNotification("操作失败", NotificationLevel.Error); } } }
private void DeleteUser_Clicked(object sender, RoutedEventArgs e) { var data = ((Button)sender).DataContext as User; if (data != null) { var result = MessageBox.Show( string.Format("你是否决定要删除用户'{0}'?", data.Name), "操作警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (result == MessageBoxResult.OK) { try { using (var dbcontext = new WarehouseContext()) { var deluser = dbcontext.Users.Find(((User)data).UserId); dbcontext.Users.Remove(deluser); dbcontext.SaveChanges(); edit_br.Child = null; ReloadUserGrid(); } } catch (Exception ex) { WindowMgr.SendNotification("删除操作失败。", NotificationLevel.Error); } } } }
void OnReqPick(NetworkMessage msg) { Log.i("LanHost OnReqPick", Log.Tag.Net); MsgPick m = msg.ReadMessage <MsgPick> (); DropItems u = mUnitMgr.getUnit(m.dropGuid) as DropItems; u.decState(UnitState.Alive | UnitState.Exist); WindowMgr.SendWindowMessage("MainWindow", "ShowDrop", u.tid); }
public MainWindow() { InitializeComponent(); InitializeNotificationBar(); var page = new Dashboard(); WindowMgr.CreateTabPage("欢迎页", "欢迎页", true, page); WindowMgr.RenderContextMenu(); }
protected override void onAwake() { TableMgr.TestModel = true; WindowMgr.SetWindowRes("ActMainWindow", "UI/ActMainWindow"); GameObject go = ResLoad.get("UI/UIRoot").gameObject(); go.GetComponent <GRoot>().mUseLua = false; }
public void CallWarehouseMapEditPage() { WarehouseContext dbcontext; var warehouseMapEditPage = WindowMgr.CreateTabPageWithDBContext("存放位置管理", "存放位置管理", true, out dbcontext); if (warehouseMapEditPage != null) { warehouseMapEditPage.Content = new WarehouseMap(dbcontext); } }
public void CallTagMgmtPage() { WarehouseContext dbcontext; var tagMgmtPage = WindowMgr.CreateTabPageWithDBContext("管理分类标签", "管理分类标签", true, out dbcontext); if (tagMgmtPage != null) { tagMgmtPage.Content = new ManageTags(dbcontext); } }
public void CallWarehouseInboundtPage() { WarehouseContext dbcontext; var tab = WindowMgr.CreateTabPageWithDBContext("入库单", "入库单", false, out dbcontext); var formControl = FormControlHelper.CreateFormControl(); formControl.CreateControlCallback = (cx, ctl) => { if (cx.ControlType == ControlType.Label && cx.PropertyInfo.Name == "InboundGoods") { ctl.VerticalAlignment = VerticalAlignment.Top; return(ctl); } if (cx.ControlType == ControlType.Editable || cx.ControlType == ControlType.Readonly) { switch (cx.PropertyInfo.Name) { case "Operator": return(RenderSelectUserControl(cx, dbcontext)); case "InboundGoods": return(new GoodsList(dbcontext)); } } return(ctl); }; //form submit callback formControl.SubmitCallback = d => { try { dbcontext.WarehouseInbounds.Add((WarehouseInbound)d); dbcontext.SaveChanges(); WindowMgr.SendNotification("入库成功", NotificationLevel.Information); WindowMgr.CloseTabPage(tab); dbcontext.Dispose(); } catch (Exception ex) { //TODO: handle exception WindowMgr.SendNotification("入库操作失败", NotificationLevel.Error); } }; var newinbound = new WarehouseInbound(); newinbound.Name = string.Format("入库 - {0}", DateTime.Now); formControl.RenderForm(newinbound, false); formControl.ConfirmButton.Content = "入库"; tab.Content = formControl; }
private void deltag_click(object sender, RoutedEventArgs e) { var data = ((TreeViewItem)tagtree.SelectedItem).DataContext as Tag; data.State = StateCode.InActive; DBContext.SaveChanges(); var tgnode = ((TreeViewItem)tagtree.SelectedItem).Parent as TreeViewItem; tgnode.Items.Remove(tagtree.SelectedItem); WindowMgr.SendNotification("标签已删除", NotificationLevel.Information); }
public void CallCreateUserTabPage() { var tab = WindowMgr.CreateTabPage("创建新用户", "创建新用户", false); var form = CallCreateUserControl((u) => { WindowMgr.SendNotification("用户创建成功", NotificationLevel.Information); WindowMgr.CloseTabPage(tab); }); tab.Content = form; }
bool CallResetPasswordPopup(User user) { var pwdwindow = new ResetPwdWindow(user); var result = pwdwindow.ShowDialog(); if (result.HasValue && result.Value) { WindowMgr.SendNotification("密码已重置", NotificationLevel.Information); return(true); } return(false); }
public void CallAddProductPage() { var dbcontext = new WarehouseContext(); var tab = WindowMgr.CreateTabPage("添加产品信息", "添加产品信息", false); var form = CallAddProductControl(null, dbcontext, (u) => { WindowMgr.SendNotification("添加产品信息成功", NotificationLevel.Information); WindowMgr.CloseTabPage(tab); dbcontext.Dispose(); }); tab.Content = form; }
private void deltaggroup_click(object sender, RoutedEventArgs e) { var data = ((TreeViewItem)tagtree.SelectedItem).DataContext as TagGroup; if (data.Tags.Count(t => t.State == StateCode.Active) > 0) { WindowMgr.SendNotification("标签组内还有标签,不能删除", NotificationLevel.Warning); return; } data.State = StateCode.InActive; DBContext.SaveChanges(); tagtree.Items.Remove(tagtree.SelectedItem); WindowMgr.SendNotification("标签组已删除", NotificationLevel.Information); }
private void UpdateTag(Tag updatetag) { var findtag = DBContext.Tags.FirstOrDefault((t) => t.Name == updatetag.Name && t.State == StateCode.Active); if (findtag != null) { WindowMgr.SendNotification("标签不能重名", NotificationLevel.Warning); } else { DBContext.SaveChanges(); WindowMgr.SendNotification("成功更改标签", NotificationLevel.Information); ShowFormGrid(false); } }
static async void MainAsync() { //init WindowMgr windowmgr = new WindowMgr(); await windowmgr.Init(); //当GUI全关闭时,让这个进程也退出 windowmgr.onAllWindowClose += () => bexit = true; //create window WindowCreateOption op = new WindowCreateOption(); op.title = "hello world"; var window = await WindowRemote.Create(windowmgr, op); //eval var time = DateTime.Now.ToString(); await window.Remote_Eval("document.body.innerHTML='hello world<hr/>" + time + "'"); }
static async void MainAsync() { //init WindowMgr windowmgr = new WindowMgr(); await windowmgr.Init(); //当GUI全关闭时,让这个进程也退出 windowmgr.onAllWindowClose += () => bexit = true; //create window WindowCreateOption op = new WindowCreateOption(); op.title = "workwithhtml"; var window = await WindowRemote.Create(windowmgr, op); var file = System.IO.Path.GetFullPath("html/mypage.html"); file = file.Replace("\\", "/"); //eval sethtmlbody //file = ""; var html = @"<iframe src = '" + file + "' style='width: 100%; height: 100%; border: 0px'></iframe>"; var evalstr = "document.body.innerHTML=\"" + html + "\";"; var v = await window.Remote_Eval(evalstr); ////eval bindevent //var bindjs = @" var btn = document.getElementById('btn'); // btn.onclick = function () { // var txt = document.getElementById('textbox'); // __api.sendback(['click', txt.value]); // };"; ////use __api.sendback([]) to send a json array to dotnet core. //await window.Remote_Eval(bindjs); //watch event window.OnSendBack += (args) => { Console.WriteLine("recv:" + args.ToString()); }; }
static async void MainAsync() { //init WindowMgr windowmgr = new WindowMgr(); await windowmgr.Init(); //当GUI全关闭时,让这个进程也退出 windowmgr.onAllWindowClose += () => bexit = true; //create window WindowCreateOption op = new WindowCreateOption(); op.title = "sendback"; var window = await WindowRemote.Create(windowmgr, op); //eval sethtmlbody var html = @" <span>input text here</span> <input id = 'textbox' type = 'text'></input> <button id = 'btn'> click me </button>"; await window.Remote_Eval("document.body.innerHTML=\"" + html + "\""); //eval bindevent var bindjs = @" var btn = document.getElementById('btn'); btn.onclick = function () { var txt = document.getElementById('textbox'); __api.sendback(['click', txt.value]); };"; //use __api.sendback([]) to send a json array to dotnet core. await window.Remote_Eval(bindjs); //watch event window.OnSendBack += (args) => { Console.WriteLine("recv:" + args.ToString()); }; }
static async void MainAsync() { //init WindowMgr windowmgr = new WindowMgr(); await windowmgr.Init(); //当GUI全关闭时,让这个进程也退出 windowmgr.onAllWindowClose += () => bexit = true; //create window WindowCreateOption op = new WindowCreateOption(); op.title = "workwithfiles"; var window = await WindowRemote.Create(windowmgr, op); var file = System.IO.Path.GetFullPath("files/tmx.png"); file = file.Replace("\\", "/"); //eval sethtmlbody //file = ""; var html = @"<span>image here</span><image src = '" + file + "'></image>"; var evalstr = "document.body.innerHTML=\"" + html + "\";"; var v = await window.Remote_Eval(evalstr); }
protected override void GameStart() { WindowMgr.SetWindowRes("TestWindow", "UI/TestWindow"); }
public void CallQueryGoodsPage() { WarehouseContext context; WindowMgr.CreateTabPageWithDBContext("查询货物", "查询货物", true, out context, new QueryGoods()); }
public void OpenManageUsersTabPage() { var usermgmtctl = new ManageUsers(); WindowMgr.CreateTabPage("管理用户", "管理用户", true, usermgmtctl); }
public Control CallUpdateUserControl(User user, Action <User> updateCallback = null) { var formControl = FormControlHelper.CreateFormControl(); // remove password formControl.DetermineFieldCreationCallback = (cx, s) => { switch (cx.PropertyInfo.Name) { case "Username": return(true); default: return(s); } }; formControl.CreateControlCallback = (cx, c) => { if (cx.ControlType == ControlType.Editable) { if (cx.PropertyInfo.Name == "Password") { return(CreateResetPwdButton(user)); } else if (cx.PropertyInfo.Name == "Username") { c.IsEnabled = false; } } return(c); }; formControl.SubmitCallback = (d) => { using (var dbcontext = new WarehouseContext()) { try { var selectuser = d as User; var updateuser = dbcontext.Users.Find(selectuser.UserId); updateuser.Name = selectuser.Name; updateuser.PhoneNumber = selectuser.PhoneNumber; updateuser.Memo = selectuser.Memo; updateuser.IdentificationNumber = selectuser.IdentificationNumber; updateuser.PermissionGroup = selectuser.PermissionGroup; updateuser.Department = selectuser.Department; dbcontext.SaveChanges(); WindowMgr.SendNotification("更新用户成功", NotificationLevel.Information); if (updateCallback != null) { updateCallback(selectuser); } } catch (Exception ex) { // TODO WindowMgr.SendNotification("更新用户失败", NotificationLevel.Error); } } }; formControl.RenderForm(user, false); formControl.ConfirmButton.Content = "保存设置"; return(formControl); }