protected DialogResult ShowDialog(RenameView rename) { if (UnderTest) { return(Dialog(rename)); } else { return(rename.ShowDialog()); } }
private void btnRename_Click(object sender, EventArgs e) { var reportResult = lbResults.SelectedItem as RecipeReportResultCacheData; if (reportResult == null) { return; } var view = new RenameView { NameField = reportResult.ReportName }; if (view.ShowDialog() != DialogResult.OK) { return; } reportResult.ReportName = view.NameField; ViewModel.RenderDocument(); }
private async void MenuItem_Click(object sender, RoutedEventArgs e) { var sendr = (MenuItem)sender; var dc = (CollectionViewGroup)sendr.DataContext; var nm = dc.Name.ToString(); var item = (DownloadImageModel)dc.Items[0];// _vieModel.FtpListItem.Items.FirstOrDefault(s => s.Name.StartsWith(nm)); if (item == null) { return; } var rnView = new RenameView(data, _vieModel.SelectedPlatform.Id); rnView.Title = $" Rename game"; rnView.Owner = Window.GetWindow(this); rnView.Icon = _vieModel.SelectedPlatform.BitmapImage; rnView.DownloadImageModel = item; var res = rnView.ShowDialog(); if (res.HasValue && res.Value) { var ftpItem = FindFtpItem(_vieModel.FtpListItem.Items.FirstOrDefault(s => s.FullName == item.FullName || item.FullName.Contains(s.FullName))); if (ftpItem == null) { return; } item.FullName = item.FullName.Replace(Path.GetFileNameWithoutExtension(ftpItem.Name), item.Name); await ftpItem.RenameFile(item.Name + Path.GetExtension(item.FullName)); var PlatformId = _vieModel.SelectedPlatform.Id; await ScrapItem(ftpItem, PlatformId, false); LiteDBHelper.Save(data); await UpdateChar(); var ch = new char[] { '!' }; await updateDownloadImageList(true, ch); } }