private void OnSaveScreenshotToFile() { ISearchResultScreenshotService service = ServicesContainer.GetService <ISearchResultScreenshotService>(); var saveFileDialog = new SaveFileDialog { CheckFileExists = false, CheckPathExists = true, Filter = "PNG Files (*.png)|*.png|All Files (*.*)|*.*", InitialDirectory = AppContext.BaseDirectory, OverwritePrompt = true, Title = "Save screenshot or armor set search result" }; if (saveFileDialog.ShowDialog() != true) { return; } var encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(service.RenderToImage(this, root.InParameters.Slots.Select(x => x.Value)))); using (FileStream fs = File.OpenWrite(saveFileDialog.FileName)) encoder.Save(fs); }
private void OnSaveScreenshotToClipboard() { ISearchResultScreenshotService service = ServicesContainer.GetService <ISearchResultScreenshotService>(); Clipboard.SetImage(service.RenderToImage(this, root.InParameters.Slots.Select(x => x.Value))); }