protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider) { using (Form form1 = new Form()) { form1.Text = "FormCollection Visualizer"; form1.StartPosition = FormStartPosition.WindowsDefaultLocation; form1.SizeGripStyle = SizeGripStyle.Auto; form1.ShowInTaskbar = false; form1.ShowIcon = false; DataTable dt; using (Stream stream = provider.GetData()) { BinaryFormatter bformatter = new BinaryFormatter(); dt = (DataTable)bformatter.Deserialize(stream); stream.Close(); } DataGridView gridView = new DataGridView(); gridView.Dock = DockStyle.Fill; form1.Controls.Add(gridView); gridView.DataSource = dt; windowService.ShowDialog(form1); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) throw new ArgumentNullException("windowService"); if (objectProvider == null) throw new ArgumentNullException("objectProvider"); DataTable dt = objectProvider.GetObject() as DataTable; if (dt != null) { using (FormMainDataSet main = new FormMainDataSet()) { main.Init(dt, objectProvider.IsObjectReplaceable, "DataRow Visualizer"); DialogResult dr = windowService.ShowDialog(main); if (objectProvider.IsObjectReplaceable && dr == DialogResult.OK) { /// DataRow is not serializable, so we serialize the item array /// in the TransferData override of the DataRowVisualizerObjectSource we deserialize the itemArray /// and update the values on the original DataRow objectProvider.TransferData(StreamSerializer.ObjectToStream(null, dt.Rows[0].ItemArray)); } } } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider) { using (Form form1 = new Form()) { form1.Paint += new PaintEventHandler(form1_Paint); form1.Text = "Font Visualizer"; font = (Font)provider.GetObject(); form1.StartPosition = FormStartPosition.WindowsDefaultLocation; form1.SizeGripStyle = SizeGripStyle.Auto; form1.ShowInTaskbar = false; form1.ShowIcon = false; Graphics formGraphics = form1.CreateGraphics(); var size = formGraphics.MeasureString(font.Name, font); form1.Width = (int)size.Width + 100; form1.Height = (int)size.Height + 100; windowService.ShowDialog(form1); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var image = (Bitmap) objectProvider.GetObject(); var dialogTitle = String.Format("Width: {0}, Height: {1}, Format: {2}", image.Width, image.Height, image.PixelFormat); var form = new Form { Text = dialogTitle, ClientSize = new Size(image.Width, image.Height), FormBorderStyle = FormBorderStyle.FixedToolWindow, }; var pictureBox = new PictureBox { Image = image, Dock = DockStyle.Fill, Parent = form, }; pictureBox.MouseMove += (s, a) => { form.Text = String.Format("{0}, RGB({1})={2}", dialogTitle, a.Location, image.GetPixel(a.Location.X, a.Location.Y)); }; windowService.ShowDialog(form); }
public VisualizerDataSource(IVisualizerObjectProvider objectProvider) { DataTable = new DataTable(); var data = ReadData(objectProvider); AddColumns(data); AddRows(data); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) throw new ArgumentNullException("windowService"); if (objectProvider == null) throw new ArgumentNullException("objectProvider"); // TODO: 取得要顯示其視覺化檢視的物件。 // 將 objectProvider.GetObject() 的結果轉型為 // 要視覺化的物件型別。 var data = (Image)objectProvider.GetObject(); // TODO: 顯示您的物件檢視。 // 以自己的自訂表單或控制項取代 displayForm。 using (Form displayForm = new Form { Text = string.Format("Width: {0}, Height: {1} Format:{2}", data.Width, data.Height, data.PixelFormat), ClientSize = new Size(data.Width, data.Height), FormBorderStyle = FormBorderStyle.FixedToolWindow, StartPosition = FormStartPosition.CenterScreen, } ) { PictureBox box = new PictureBox { Image = data, Dock = DockStyle.Fill }; displayForm.Controls.Add(box); windowService.ShowDialog(displayForm); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { try { if (windowService == null) { throw new ArgumentNullException("windowService"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } object data = (object)objectProvider.GetObject(); System.Data.DataSet ds = data as System.Data.DataSet; if (ds == null) { throw new ArgumentException("Only DataSets can be visualized with the ExtendedDataSetVisualizer"); } using (ExtendedDataSetVisualizerWin win = new ExtendedDataSetVisualizerWin(ds)) { windowService.ShowDialog(win); } } catch (System.Exception rExc) { MessageBox.Show(rExc.Message); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService != null) { if (objectProvider != null) { var obj = objectProvider.GetObject() as QueryData; // flag1 = obj == null; if (obj != null) { var form = new EfVisualizerForm(); if (!string.IsNullOrEmpty(obj.ExceptionMessage)) { form.SetDebugText(string.Format("Error:{0}{1}", Environment.NewLine, obj.ExceptionMessage)); } else { form.SetDebugText(obj.SQLCommand); } DialogResult dialogResult = windowService.ShowDialog(form); } } else { throw new ArgumentNullException("objectProvider"); } } else { throw new ArgumentNullException("windowService"); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Stream pixbuf_stream = objectProvider.GetData(); BinaryReader reader = new BinaryReader (pixbuf_stream); bool has_alpha; int bits_per_sample, width, height, rowstride; Gdk.Pixbuf pixbuf; has_alpha = reader.ReadBoolean (); bits_per_sample = reader.ReadInt32 (); width = reader.ReadInt32 (); height = reader.ReadInt32 (); rowstride = reader.ReadInt32 (); int size = height * rowstride; byte[] pixbuf_data = new byte [size]; reader.Read (pixbuf_data, 0, size); pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height); Marshal.Copy (pixbuf_data, 0, pixbuf.Pixels, size); PixbufWindow win = new PixbufWindow ("Pixbuf Visualizer", pixbuf); win.Show (); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { try { var obj = objectProvider.GetData(); var modelNode = new M2ModelDialogDebuggerVisualizerService().DeserializeDataFromStream<ModelNode>(obj); var form = new Form { ClientSize = new Size(800, 600), FormBorderStyle = FormBorderStyle.FixedToolWindow, }; var treeView = new TreeView(); treeView.Parent = form; treeView.Dock = DockStyle.Fill; InitNodes(treeView.Nodes, modelNode); treeView.ExpandAll(); windowService.ShowDialog(form); } catch (Exception e) { // TODO throw; } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var board = (objectProvider.GetObject()) as Board; new GoBoardForm(board).ShowDialog(); }
protected override void Show(IDialogVisualizerService p_windowService, IVisualizerObjectProvider p_objectProvider) { try { // Get data from VisualizerBase as Stream using (Stream objStreamData = p_objectProvider.GetData()) { BinaryFormatter bf = new BinaryFormatter(); // Create instance from that stream BaseTable objBaseVisualizer = (BaseTable)bf.Deserialize(objStreamData); // We get the first table in list (since we only use this one in DataTable visualizer) VisualizerBaseTable objTable = objBaseVisualizer.MyTableToVisualize[0]; // We create new Form VisualizerForm frmVisualizerForm = new VisualizerForm(objTable); // And walla frmVisualizerForm.ShowDialog(); } } catch (Exception ex) { UiHelper.MyMessageBox("Error while opening " + UiHelper.APP_NAME + " - DataTable Visualizer", ex); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { StringBuilder sb = new StringBuilder(); var ilBytes = ((ILDelta)objectProvider.GetObject()).Value; var viewer = new TextViewer(ilBytes.GetMethodIL(), "IL"); viewer.ShowDialog(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var bitmap = (Bitmap)objectProvider.GetObject(); if (bitmap == null) throw new NullReferenceException("Make sure your Bitmap is not null."); var form = new Form { Text = String.Format("ImageView - W: {0}px H: {1}px", bitmap.Width, bitmap.Height), ClientSize = new Size(480, 320), FormBorderStyle = FormBorderStyle.Sizable, ShowInTaskbar = false, ShowIcon = false }; var pictureBox = new PictureBox { SizeMode = PictureBoxSizeMode.Zoom, Image = bitmap, Parent = form, Dock = DockStyle.Fill }; form.ShowDialog(); }
/// <summary> /// Contains the code that actually creates the ChromeVisualizer (by starting its process) /// </summary> /// <param name="windowService"></param> /// <param name="objectProvider"></param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { // Get the HTML we want to visualize string html = objectProvider.GetObject().ToString(); // Get temp file path string htmlFilePath = Path.GetTempFileName() + ".html"; try { // Try to write it out File.WriteAllText(htmlFilePath, html, Encoding.UTF8); } catch (Exception exc) { // Report it to the user MessageBox.Show("Failed to save HTML to a temporary text file: " + exc.Message); return; } // Create a new process to launch our chrome visualizer Process process = new Process(); // Link to the ChromeVisualizer.exe file process.StartInfo.FileName = chromeVisualizerPath; // Pass the HTML temp file path as argument process.StartInfo.Arguments = htmlFilePath; // Maximize the window process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; try { // Finally, start the process! process.Start(); } catch (Exception exc) { // Report it to the user MessageBox.Show("Failed to start the Chrome Visualizer executable: " + exc.Message); return; } // Wait for user to close window process.WaitForExit(); try { // Finally, try to delete the temp file File.Delete(htmlFilePath); } catch (Exception exc) { // Report it to the user MessageBox.Show("Failed to delete the temporary HTML file: " + exc.Message); return; } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var fixMessageString = objectProvider.GetObject().ToString(); var directoryPath = Path.GetDirectoryName(Uri.UnescapeDataString(new System.Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath)); FixMessageVisualizerDialog.Show(fixMessageString, new ConventionBasedFixDictionarySource(directoryPath), null); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var nodeProxy = (INodeProxy)objectProvider.GetObject(); var window = new VisualizerWindow { DataContext = new VisualizerViewModel(nodeProxy) }; window.ShowDialog(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { SerializedProxy data = (SerializedProxy)objectProvider.GetObject (); //MessageBox.Show(data.ProxyType.FullName); AopProxyVisualizerForm form = new AopProxyVisualizerForm(); form.Proxy = data; windowService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MainForm preview = new MainForm(); DataTable dt = null; dt = (DataTable)objectProvider.GetObject(); object rowObject = dt.Rows[dt.Rows.Count - 1][0]; preview.ShowData(dt, rowObject.ToString()); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var frm = new FrmImage(); var img = objectProvider.GetObject() as Image; if (img == null) return; frm.Picture = img; windowService.ShowDialog(frm); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var window = new Window { Content = new View((IEnumerable<object>) objectProvider.GetObject()) }; window.ShowDialog(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { StringWindow win = new StringWindow (objectProvider.GetObject().ToString()); win.Editable = objectProvider.IsObjectReplaceable; win.Show (); }
/// <summary> /// 表示 /// </summary> /// <param name="windowService"></param> /// <param name="objectProvider"></param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (MatrixVisualizerForm displayForm = new MatrixVisualizerForm()) { displayForm.SetMatrix(objectProvider.GetObject() as KrdLab.Lisys.Matrix); windowService.ShowDialog(displayForm); } }
private XElement ReadData(IVisualizerObjectProvider objectProvider) { var data = new XElement("Result"); using (var sr = new IO.StreamReader(objectProvider.GetData())) { data = XElement.Parse(sr.ReadToEnd()); } return data; }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (JsonVisualizerForm form = new JsonVisualizerForm()) { form.Viewer.Json = objectProvider.GetObject().ToString(); windowService.ShowDialog(form); } }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider ) { Image image = (Image)objectProvider.GetObject(); using( ViewImageDialog dialog = new ViewImageDialog() ) { dialog.Image = image; windowService.ShowDialog( dialog ); } }
override protected void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider ) { BestCS.Math.Histogram histogram = ( BestCS.Math.Histogram) objectProvider.GetObject( ); HistogramView histogramView = new HistogramView( ); histogramView.SetHistogram( histogram ); windowService.ShowDialog( histogramView ); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var stream = objectProvider.GetData(); var reader = new StreamReader(stream); var text = reader.ReadToEnd(); var viewer = new TextViewer(text, "IL"); viewer.ShowDialog(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var msg = new StreamReader(objectProvider.GetData()).ReadToEnd(); var form = new AsposeVisualizerForm(); form.SetText(msg); windowService.ShowDialog(form); }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (var visualizer = new MockVisualizerForm(objectProvider.GetObject())) { windowService.ShowDialog(visualizer); } }
/// <summary> /// Shows the specified window service. /// </summary> /// <param name="windowService">The window service.</param> /// <param name="objectProvider">The object provider.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (BitmapDataInfo bitmapDataInfo = SerializationHelper.DeserializeBitmapDataInfo(objectProvider.GetData())) DebuggerHelper.DebugBitmapData(bitmapDataInfo); }
public void Initialize(IVisualizerObjectProvider objectProvider, TConfig config) => Initialize(objectProvider, config, NoAction);
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var wrapper = (SqlCommandWrapper)objectProvider.GetObject(); ShowDialog(wrapper.SqlText); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MDataTable dt = objectProvider.GetObject() as DataTable; FormCreate.BindTable(windowService, dt, null); }
/// <summary> /// /// </summary> /// <param name="windowService"></param> /// <param name="objectProvider"></param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Process.Start(new BinaryReader(objectProvider.GetData()).ReadString()); }
public ImageForm(IVisualizerObjectProvider objectProvider) { InitializeComponent(); #if DEBUG this.ShowInTaskbar = true; #endif this.label1.Font = UIFont; SetFontAndScale(this.label1, UIFont); this.label2.Font = UIFont; this.txtExpression.Font = UIFont; this.btnClose.Font = UIFont; object objectBitmap = objectProvider.GetObject(); if (objectBitmap != null) { #if DEBUG string expression = objectBitmap.ToString(); #endif var method = objectBitmap.GetType().GetMethod("ToBitmap", new Type[] { }); if (method != null) { objectBitmap = method.Invoke(objectBitmap, null); } BitmapSource bitmapSource = null; if (objectBitmap is Bitmap) { var hObject = ((Bitmap)objectBitmap).GetHbitmap(); try { bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( hObject, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); } catch (Win32Exception) { bitmapSource = null; } finally { DeleteObject(hObject); } } else if (objectBitmap is SerializableBitmapImage serializableBitmapImage) { bitmapSource = serializableBitmapImage; } if (bitmapSource != null) { imageControl.SetImage(bitmapSource); } } txtExpression.Text = objectProvider.GetObject().ToString(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MLVisualizer.ShowVisualizer(windowService, objectProvider); }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { string text = new StreamReader(objectProvider.GetData()).ReadLine(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MessageBox.Show(objectProvider.GetObject().ToString()); }
////sono2 //protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) //{ // var data = (MyBitmapSourceProxy)objectProvider.GetObject(); // //bitmapSourceからbitmapを作成 // var bitmapSource = BitmapSource.Create(data.Width, data.Height, 96, 96, PixelFormats.Bgra32, null, data.Pixels, data.Stride); // var bmp = new Bitmap(data.Width, data.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); // var bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, bmp.PixelFormat); // bitmapSource.CopyPixels(Int32Rect.Empty, bmpData.Scan0, bmpData.Height * bmpData.Stride, bmpData.Stride); // bmp.UnlockBits(bmpData); // PictureBox pictureBox = new PictureBox // { // Image = bmp, // SizeMode = PictureBoxSizeMode.AutoSize // }; // using (Form displayForm = new Form()) // { // displayForm.Text = data.ToString(); // displayForm.Controls.Add(pictureBox); // windowService.ShowDialog(displayForm); // } // bmp.Dispose(); // pictureBox.Dispose(); //} //sono3、失敗、本当はこれがいい、bitmapSourceをそのまま表示できる protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var data = (MyBitmapSourceProxy)objectProvider.GetObject(); //↑GetDataが実行されている? //PixelFormatを再構成 Guid guid = Guid.Parse(data.Format); PixelFormat pxFormat = (PixelFormat)Activator.CreateInstance(typeof(PixelFormat), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance, null, new object[] { guid }, null); //paletteを再構成 BitmapPalette palette = MakePalette(data.Palette); //bitmapSourceを再構成 var bitmapSource = BitmapSource.Create(data.Width, data.Height, 96, 96, pxFormat, palette, data.Pixels, data.Stride); //ここでエラー" 呼び出しスレッドは、多数の ui コンポーネントが必要としているため、sta である必要があります" //var wpf = new System.Windows.Forms.Integration.ElementHost //{ // Child = new UserControl1(bitmapSource) //}; System.Windows.Forms.Integration.ElementHost elementHost1; //WPFのButtonコントロールを作成する System.Windows.Controls.Button wpfButton = new System.Windows.Controls.Button(); wpfButton.Content = "Push!"; //ElementHostコントロールを作成する elementHost1 = new System.Windows.Forms.Integration.ElementHost(); //コントロールの位置と大きさを設定する elementHost1.SetBounds(20, 10, 100, 30); //ElementHostのChildプロパティにWPFコントロールを設定する elementHost1.Child = wpfButton; var wpfImage = new System.Windows.Controls.Image(); wpfImage.Source = bitmapSource; elementHost1.Child = wpfImage; //ElementHostをフォームに配置する //this.Controls.Add(elementHost1); //Formに画像表示 var f = new Form { Controls = { elementHost1 } }; windowService.ShowDialog(f); f.Dispose(); //using (Form displayForm = new Form()) //{ // displayForm.Text = data.ToString(); // displayForm.Controls = { wpf } // windowService.ShowDialog(displayForm); //} }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { ShowInstructionsWindow(windowService, objectProvider.GetData()); }
protected override Function LoadData(IVisualizerObjectProvider objectProvider) { return(StreamToFunction(objectProvider.GetData())); }
/// <summary> /// Shows the specified window service. /// </summary> /// <param name="windowService">The window service.</param> /// <param name="objectProvider">The object provider.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (GraphicsInfo graphicsInfo = SerializationHelper.DeserializeGraphicsInfo(objectProvider.GetData())) DebuggerHelper.DebugGraphics(graphicsInfo); }
/// <summary> /// Shows the chess board visualizer. /// </summary> /// <param name="windowService">Window service used to show the visualizer.</param> /// <param name="objectProvider">The providers used to get the object to be inspected.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) { throw new ArgumentNullException(nameof(windowService)); } if (objectProvider == null) { throw new ArgumentNullException(nameof(objectProvider)); } var chessBoard = (ChessRepresentation)objectProvider.GetObject(); using (var displayForm = new Form()) { var history = chessBoard.Clone().History.ToArray(); var index = Math.Max(history.Length, 0); displayForm.Size = new Size(400, 400); displayForm.FormBorderStyle = FormBorderStyle.SizableToolWindow; displayForm.Text = $"Current player: {chessBoard.CurrentPlayer} ({index}/{history.Length})"; var chessPanel = new ChessBoardVisualizerPanel(); chessPanel.ChessRepresentation = chessBoard; displayForm.Controls.Add(chessPanel); chessPanel.Dock = DockStyle.Fill; displayForm.ResizeEnd += (sender, args) => chessPanel.Refresh(); displayForm.KeyUp += (sender, args) => { ChessRepresentation newBoard; switch (args.KeyCode) { case Keys.Left: if (index > 0) { index--; } newBoard = CalculateBoard(history, index); break; case Keys.Right: if (index < history.Length) { index++; } newBoard = CalculateBoard(history, index); break; case Keys.Home: index = 0; newBoard = CalculateBoard(history, index); break; case Keys.End: index = history.Length; newBoard = CalculateBoard(history, index); break; case Keys.F1: MessageBox.Show( "Left arrow:\tGo back in history.\r\nRight arrow:\tGo forward in history\r\nEscape:\t\tClose Window\r\nF1:\t\tHelp dialog\r\nHome\t\tGo to start state\r\nEnd\t\tGo to end", "Chessboard visualizer help"); return; case Keys.Escape: // ReSharper disable once AccessToDisposedClosure displayForm.Close(); return; default: return; } chessPanel.ChessRepresentation = newBoard; // ReSharper disable once AccessToDisposedClosure displayForm.Text = $"Current player: {newBoard.CurrentPlayer} ({index}/{history.Length})"; }; windowService.ShowDialog(displayForm); } }
override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MDataTable dt = MDataTable.CreateFrom(objectProvider.GetObject() as string); FormCreate.BindTable(windowService, dt, null); }
public void SetObjectProvider(IVisualizerObjectProvider objectProvider) { m_objectProvider = objectProvider; this.GetObjectData(); this.UpdateForm(false); }
/// <summary> /// 查询信息的格式和所需的 UI 通常取决于 /// 该查询使用的 Linq to SQLq 提供程序。 /// 因此,在此常规查询可视化工具中,我们只从流读取特定查询 /// 可视化工具的程序集和类,并调用此类上的方法“Display”,然后该方法将 /// 读取查询信息,并显示 UI。 /// </summary> /// <param name="windowService"> 用于显示 UI </param> /// <param name="objectProvider"> 用于从可视化工具代理检索数据(以流的形式) </param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Stream rawStream = objectProvider.GetData(); Visualizer.Display(windowService, rawStream); }
public ImageForm(IVisualizerObjectProvider objectProvider) { InitializeComponent(); #if DEBUG ShowInTaskbar = true; #endif label1.Font = UIFont; SetFontAndScale(label1, UIFont); label2.Font = UIFont; txtExpression.Font = UIFont; CloseB.Font = UIFont; object objectBitmap = objectProvider.GetObject(); object image = null; if (objectBitmap != null) { if (objectBitmap is ByteArraySerializableWrapper <SoftwareBitmap> wrapper) { image = Serializer.ToSoftwareBitmap(wrapper.Bytes); } #if DEBUG string expression = objectBitmap.ToString(); #endif var method = objectBitmap.GetType().GetMethod("ToBitmap", new Type[] { }); if (method != null) { objectBitmap = method.Invoke(objectBitmap, null); } System.Windows.Media.ImageSource bitmapSource = null; if (objectBitmap is Bitmap) { image = objectBitmap; //var hObject = ((Bitmap)objectBitmap).GetHbitmap(); //try //{ // bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( // hObject, // IntPtr.Zero, // Int32Rect.Empty, // BitmapSizeOptions.FromEmptyOptions()); // image = bitmapSource; //} //catch (Win32Exception) //{ // bitmapSource = null; //} //finally //{ // DeleteObject(hObject); //} } else if (objectBitmap is SerializableBitmapImage serializableBitmapImage) { if (serializableBitmapImage.Image != null) { bitmapSource = (System.Windows.Media.Imaging.BitmapSource)serializableBitmapImage; } else if (serializableBitmapImage.SoftwareBitmap != null) { using (var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream()) { Windows.Graphics.Imaging.BitmapEncoder encoder = Windows.Graphics.Imaging.BitmapEncoder.CreateAsync(Windows.Graphics.Imaging.BitmapEncoder.PngEncoderId, stream).GetResults(); encoder.SetSoftwareBitmap(serializableBitmapImage.SoftwareBitmap); var t = Task.Run(async() => await encoder.FlushAsync()); t.GetAwaiter().GetResult(); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = stream.AsStream(); bitmap.CacheOption = BitmapCacheOption.OnLoad; bitmap.EndInit(); bitmap.Freeze(); bitmapSource = bitmap; image = (ImageSource)bitmap; // use bitmap } //using (var sb = serializableBitmapImage.SoftwareBitmap.LockBuffer()) //{ // var source = WriteableBitmap.Create(serializableBitmapImage.SoftwareBitmap.PixelWidth, serializableBitmapImage.SoftwareBitmap.PixelHeight, serializableBitmapImage.SoftwareBitmap.DpiX, serializableBitmapImage.SoftwareBitmap.DpiY, // serializableBitmapImage.SoftwareBitmap.BitmapPixelFormat, null, sb.CreateReference()., serializableBitmapImage.SoftwareBitmap.PixelWidth); // source. //} // var bs = new SoftwareBitmapSource(); // await bs.SetBitmapAsync(serializableBitmapImage.SoftwareBitmap); //bitmapSource = bs; } } //if (bitmapSource != null) //{ // imageControl.SetImage(bitmapSource); //} var type = image.GetType(); Func <ImageUserControl> factory = null; while (type != null && !ImageControls.TryGetValue(type, out factory)) { type = type.BaseType; } if (factory is { })
protected override async void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var launchedInstance = LaunchNewInstance(); await CommunicationHelper.SendToInstance(launchedInstance.TcpPort, objectProvider.GetData()); }
protected abstract T LoadData(IVisualizerObjectProvider objectProvider);
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { object o = objectProvider.GetObject(); System.Diagnostics.Debugger.Launch(); }