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) { 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) { 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); }
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) { SerializedProxy data = (SerializedProxy)objectProvider.GetObject (); //MessageBox.Show(data.ProxyType.FullName); AopProxyVisualizerForm form = new AopProxyVisualizerForm(); form.Proxy = data; windowService.ShowDialog(form); }
/// <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); } }
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) { 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) { tgEntityCollectionBase data = (tgEntityCollectionBase)objectProvider.GetObject(); using (esVisualizerForm displayForm = new esVisualizerForm(data)) { windowService.ShowDialog(displayForm); } }
/// <summary/> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { ObjectProvider = objectProvider; RootProxy = BplRootProxyQuery.Invoke(this).Result; var sourcePath = BplSourcePathQuery.Invoke(this).Result; SourceProxy = sourcePath.RetrieveProxy(this); var form = new BplVisualizerForm(this); windowService.ShowDialog(form); }
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); }
override protected void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider ) { Image image = (Image) objectProvider.GetObject( ); ImageView imageViewer = new ImageView( ); imageViewer.SetImage( image ); windowService.ShowDialog( imageViewer ); }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (var visualizer = new MockVisualizerForm(objectProvider.GetObject())) { windowService.ShowDialog(visualizer); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var streamReader = new StreamReader(objectProvider.GetData()); var stateMachineSource = streamReader.ReadToEnd(); var pointer = (int)stateMachineSource[0]; var form = new StateMachineVisualiserForm(pointer, stateMachineSource.Substring(1)); windowService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) throw new ArgumentNullException("windowService"); if (objectProvider == null) throw new ArgumentNullException("objectProvider"); var cfg = (Configuration)objectProvider.GetObject(); using (var frmVisualizer = new FrmVisualizer(cfg)) windowService.ShowDialog(frmVisualizer); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { modalService = windowService; if (modalService == null) throw new NotSupportedException("This debugger does not support modal visualizers"); var containerDetail = (ContainerDetail) objectProvider.GetObject(); var form = new ContainerForm(containerDetail); modalService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var formatter = new BinaryFormatter(); var data = formatter.Deserialize(objectProvider.GetData()); if (data is InternalColorFrame) { windowService.ShowDialog(new Kinect2DFrameVisualizerForm(data as InternalColorFrame, true) { Text = Properties.Resources.ColorFrameImageDialogDebuggerVisualizer }); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var owner = objectProvider.GetObject(); var node = owner as AbstractNode; if (node != null) { AstView v = new AstView {Unit = node, Dock = DockStyle.Fill}; windowService.ShowDialog(v); } }
///<param name="objectProvider">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IVisualizerObjectProvider"></see>. This object provides communication from the debugger side of the visualizer to the object source (<see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.VisualizerObjectSource"></see>) on the debuggee side.</param> ///<param name="windowService">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IDialogVisualizerService"></see>, which provides methods your visualizer can use to display Windows forms, controls, and dialogs.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Scope s = objectProvider.GetObject() as Scope; ScopeTreeView view = new ScopeTreeView(); Form dlg = new Form(); dlg.Controls.Add(view); view.Dock=DockStyle.Fill; view.ShowScope(s); windowService.ShowDialog(dlg); }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider ) { using( SerializableGraphics wrapper = (SerializableGraphics)objectProvider.GetObject() ) { using( ViewImageDialog dialog = new ViewImageDialog() ) { dialog.Image = wrapper.Bitmap; windowService.ShowDialog( dialog ); } } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Image image = (Image)objectProvider.GetObject(); MainForm form = new MainForm(); form.Text = string.Format("Width: {0}, Height: {1}", image.Width, image.Height); form.ClientSize = new Size(image.Width, image.Height); form.img = image; windowService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { MatchCollection matches = (MatchCollection) objectProvider.GetObject(); MatchCollectionVisualizerCtl hostedControl = new MatchCollectionVisualizerCtl(); hostedControl.DisplayMatches(matches); using (VisualizerDisplayForm form = new VisualizerDisplayForm("Matches Details")) { form.HostControl(hostedControl); windowService.ShowDialog((Form) form); } }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider ) { modalService = windowService; if( modalService == null ) throw new NotSupportedException( "This debugger does not support modal visualizers" ); XmlDocument xml = new XmlDocument(); xml.LoadXml( objectProvider.GetObject().ToString() ); XmlVisualizerForm form = new XmlVisualizerForm( xml.DocumentElement ); modalService.ShowDialog( form ); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { string json = (objectProvider.GetObject() as string); MainForm form = new MainForm { Json = json }; windowService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Regex r = (Regex) objectProvider.GetObject(); MatchCollectionVisualizerCtl hostedControl = new MatchCollectionVisualizerCtl(); using (VisualizerDisplayForm form = new VisualizerDisplayForm("Regex Details")) { hostedControl.DisplayRegex(r); form.HostControl(hostedControl); windowService.ShowDialog((Form) form); } }
/// <summary> /// Display the visualizer user interface. /// </summary> /// <remarks>This method is used by Visual Studio, and is not intended to be called from your code.</remarks> /// <param name="windowService">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IDialogVisualizerService"></see>, which provides methods your visualizer can use to display Windows forms, controls, and dialogs.</param> /// <param name="objectProvider">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IVisualizerObjectProvider"></see>. This object provides communication from the debugger side of the visualizer to the object source (<see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.VisualizerObjectSource"></see>) on the debuggee side.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { try { object data = objectProvider.GetObject(); if (data is ObjectListView) { using (VisualizerForm displayForm = new VisualizerForm()) { displayForm.View = (ObjectListView)data; windowService.ShowDialog(displayForm); } } else { // If ObjectListView<T> Type dataType = data.GetType(); if (dataType.IsGenericType && dataType.GetGenericTypeDefinition() == typeof(ObjectListView<>)) { // Construct a VisualizerForm<T> Type visType = typeof(VisualizerTForm<>); Type visConstructed = visType.MakeGenericType(data.GetType().GetGenericArguments()); object v = Activator.CreateInstance(visConstructed); PropertyInfo view = visConstructed.GetProperty("View"); view.SetValue(v, data, null); Form visualizerForm = (Form)v; using (visualizerForm) { windowService.ShowDialog(visualizerForm); } } } } catch (Exception ex) { if (ex.GetType().Name == "RemoteObjectSourceException") // it's an internal type that derives directly from System.Exception MessageBox.Show("The visualizer cannot be displayed because your list item type is not marked Serializable.", "Visualizer Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else throw; } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) { throw new ArgumentNullException("windowService"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } // TODO: Obter o objeto para o qual exibir um visualizador. // Converte o resultado de objectProvider.GetObject() // para o tipo do objeto sendo visualizado. object data = (object)objectProvider.GetObject(); // TODO: Exibir sua visão do objeto. // Substituir displayForm com seu próprio Controle ou Formulário personalizado. using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) { throw new ArgumentNullException("windowService"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } //BitmapSourceをBitmapへ変換 var data = (MyProxy)objectProvider.GetObject(); OriginBitmapSource = BitmapSource.Create(data.Width, data.Height, 96, 96, PixelFormats.Bgra32, null, data.Pixels, data.Stride); OriginBitmap = new Bitmap(data.Width, data.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); var bmpData = OriginBitmap.LockBits(new Rectangle(0, 0, OriginBitmap.Width, OriginBitmap.Height), ImageLockMode.ReadOnly, OriginBitmap.PixelFormat); OriginBitmapSource.CopyPixels(Int32Rect.Empty, bmpData.Scan0, bmpData.Height * bmpData.Stride, bmpData.Stride); OriginBitmap.UnlockBits(bmpData); //this.OriginBitmap = (Bitmap)objectProvider.GetObject(); //Form作成表示 using (MyForm = new Form()) { //FormにボタンとかPictureBox追加 AddToolStrip(); MyForm.Text = "BitmapSourceVisualizer"; MyForm.BackColor = System.Drawing.Color.White; MyForm.Width = Screen.PrimaryScreen.Bounds.Width / 2; MyForm.Height = Screen.PrimaryScreen.Bounds.Height / 2; windowService.ShowDialog(MyForm); } //this.OriginBitmap.Dispose(); }
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() // к типу визуализируемого объекта. object data = (object)objectProvider.GetObject(); // TODO: отобразите свое представление объекта. // Замените displayForm на свой объект Form или Control. using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService != null && objectProvider != null) { // Get serialized object stream from debuggee side. Stream stream = objectProvider.GetData(); if (stream != null && stream.Length > 0) { // Deserialize the object stream. var transporter = (SyntaxTransporter)SyntaxSerializer.Deserialize(stream); if (transporter != null) { using (SyntaxDebuggerVisualizerForm form = new SyntaxDebuggerVisualizerForm()) { // Display the deserialized object. form.Display(transporter); windowService.ShowDialog(form); } } } } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) { throw new ArgumentNullException("windowService"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } if (!(objectProvider.GetObject() is Vector)) { throw new ArgumentException("Object type is not Matrix"); } var data = (Vector)objectProvider.GetObject(); using (DataVisualizerForm f = new DataVisualizerForm()) { f.Text = "Vector"; f.SetData(data); windowService.ShowDialog(f); } }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { if (windowService == null) { throw new ArgumentNullException("windowService"); } if (objectProvider == null) { throw new ArgumentNullException("objectProvider"); } // TODO: Get the object to display a visualizer for. // Cast the result of objectProvider.GetObject() // to the type of the object being visualized. object data = (object)objectProvider.GetObject(); // TODO: Display your view of the object. // Replace displayForm with your own custom Form or Control. using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
private void BindTable(IDialogVisualizerService windowService, MDataTable dt) { if (dt == null) { return; } //if (dt.Rows.Count > 200) //{ // dt = dt.Select(200, null); //} //插入行号 MCellStruct ms = new MCellStruct("索引", System.Data.SqlDbType.Int); dt.Columns.Insert(0, ms); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][0].Value = i; } CollectionViewMain form = new CollectionViewMain(dt.ToDataTable()); windowService.ShowDialog(form); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Log.Configure("LINQBridgeVs", "DynamicDebuggerVisualizerV14"); try { DynamicDebuggerVisualizer dynamicDebuggerVisualizer = new DynamicDebuggerVisualizer(); Stream dataStream = objectProvider.GetData(); if (dataStream.Length == 0) { return; } Form formToShow = dynamicDebuggerVisualizer.ShowLINQPad(dataStream, VsReferencedVersion); #if !TEST windowService.ShowDialog(formToShow); #endif } catch (Exception exception) { Log.Write(exception, "Error during LINQPad execution"); } }
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() の結果を視覚化 // されるオブジェクトの型にキャストします。 object data = (object)objectProvider.GetObject(); // TODO: オブジェクトのビューを表示します。 // displayForm をユーザー独自のカスタム フォームまたはコントロールで置き換えます。 using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
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() 的结果的类型强制转换为 // 要可视化的对象的类型。 object data = (object)objectProvider.GetObject(); // TODO: 显示您的对象视图。 // 将 displayForm 替换为您自己的自定义窗体或控件。 using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
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() 的結果轉型為 // 要視覺化的物件型別。 object data = (object)objectProvider.GetObject(); // TODO: 顯示您的物件檢視。 // 以自己的自訂表單或控制項取代 displayForm。 using (Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } }
// Method called by VS when the visualizer is opened. override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Guid guid = (Guid)objectProvider.GetObject(); var form = new Form { Text = "Guid Visualizer", AutoScaleDimensions = new SizeF(6F, 13F), AutoScaleMode = AutoScaleMode.Font, ClientSize = new Size(500, 235), FormBorderStyle = FormBorderStyle.FixedToolWindow, TopMost = true }; // // guidLabel // var guidLabel = new Label { AutoSize = false, Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Location = new Point(24, 18), Name = "guidLabel", Size = new Size(55, 24), Text = "Guid:" }; // // nameLabel // var nameLabel = new Label { AutoSize = false, Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Location = new Point(24, 61), Name = "nameLabel", Size = new Size(66, 24), Text = "Name:" }; // // guidValueLabel // var guidValueLabel = new Label { AutoSize = false, Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Location = new Point(96, 18), Name = "guidValueLabel", Size = new Size(373, 24), Text = guid.ToString().ToUpper() }; // // nameValueLabel // var nameValueLabel = new Label { AutoSize = false, Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Location = new Point(96, 61), Name = "nameValueLabel", Size = new Size(373, 24), Text = GetNameFromGuid(guid) ?? "Could not find associated name to GUID" }; // // infoLabel // var infoLabel = new Label { AutoSize = false, Location = new Point(25, 125), Name = "infoLabel", Size = new Size(300, 65), Text = $"{NameByGuid.Count} Guids loaded\n" }; // Add Controls form.Controls.Add(nameValueLabel); form.Controls.Add(infoLabel); form.Controls.Add(guidValueLabel); form.Controls.Add(nameLabel); form.Controls.Add(guidLabel); // Show form windowService.ShowDialog(form); }
////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); //} }
/// <summary> /// Uses <see cref="MatrixVisualizer.VisualizationProvider"/> to display the matrix /// </summary> /// <param name="windowService"></param> /// <param name="objectProvider"></param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (var form = MatrixVisualizer.VisualizationProvider.GetForm(objectProvider.GetObject())) { windowService.ShowDialog(form); } }
/// <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); } }
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() の結果をキャスト // されるオブジェクトの型にキャストします。 //MessageBox.Show(objectProvider.GetObject().ToString()); //System.Windows.Media.Imaging.BitmapSource source = (System.Windows.Media.Imaging.BitmapSource)objectProvider; //System.Windows.Controls.Image image = new System.Windows.Controls.Image(); //image.Source = source; //object data = (object)objectProvider.GetObject(); //hostControl //System.Windows.Window window = new System.Windows.Window(); //window.Title = objectProvider.GetObject().ToString(); //var elementHost = new System.Windows.Forms.Integration.ElementHost(); //elementHost.SetBounds(20, 10, 100, 30); //elementHost.Child = window; var el = new System.Windows.Forms.Integration.ElementHost() { Child = (System.Windows.Window)objectProvider }; //var c = new Button(); var form = new Form { Text = "ok", Controls = { el } }; windowService.ShowDialog(form); //form.Dispose(); //c.Dispose(); //using (var f = new Form { Text = "ok" }) //{ // //f.Controls.Add(new Button() { Text = "butttttttttttttt" }); // //f.Controls.Add(new System.Windows.Forms.Integration.ElementHost()); // //f.Controls.Add(elementHost); // windowService.ShowDialog(f); //} //// TODO: オブジェクトのビューを表示します。 //// displayForm をユーザー独自のカスタム フォームまたはコントロールで置き換えます。 //using (Form displayForm = new Form()) //{ // displayForm.Text = ""; // //displayForm.Text = data.ToString(); // windowService.ShowDialog(displayForm); //} }
/// <summary> /// Shows this form as the context of the DialogVisualizer /// </summary> /// <param name="windowService"></param> public void ShowDialog(IDialogVisualizerService windowService) { // Trace.WriteLine("DebugForm ShowDialog"); windowService.ShowDialog(this); }
//private const string _assemblyName = "__QRFpML.XmlSerializer.dll"; protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var visualizerForm = new NamedValueSetVisualizerForm(objectProvider.GetObject() as NamedValueSet); windowService.ShowDialog(visualizerForm); }