private async void RefreshWebShell() { m_pShellListModeView.Clear(); //获取所有webshell var webshellList = await DataBaseManager.QueryAllWebShell(); foreach (var item in webshellList) { m_pShellListModeView.Add(new ModeView.ShellListGridViewModeView(item.Url, item.CreateTime, item)); } }
private async void OnAddWebShell(object sender, RoutedEventArgs e) { WebShellConfigDialog dlg = new WebShellConfigDialog(); var result = await dlg.ShowAsync(); if (result == ContentDialogResult.Primary) { //确定 var webShellInfo = dlg.GetWebShellConfig(); //设置创建时间 webShellInfo.CreateTime = DateTime.Now.ToFileTimeUtc(); await DataBaseManager.AddWebShellAsync(webShellInfo); ModeView.ShellListGridViewModeView webShellItem = new ModeView.ShellListGridViewModeView(webShellInfo.Url, webShellInfo.CreateTime, webShellInfo); m_pShellListModeView.Add(webShellItem); } }
private async Task ModifyWebShell(CWebShellInfo info) { WebShellConfigDialog dlg = new WebShellConfigDialog(); dlg.SetWebShellConfig(info); var result = await dlg.ShowAsync(); if (result == ContentDialogResult.Primary) { info = dlg.GetWebShellConfig(); //更新数据库 await DataBaseManager.ModifyWebShellAsync(info); //更新界面数据 var modifyItem = (from item in m_pShellListModeView where item.Guid == info.Guid select item).FirstOrDefault(); modifyItem.SetFromData(info); } //RefreshWebShell(); }