本文整理汇总了C#中ElementHost类的典型用法代码示例。如果您正苦于以下问题:C# ElementHost类的具体用法?C# ElementHost怎么用?C# ElementHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElementHost类属于命名空间,在下文中一共展示了ElementHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BulkImportAddin
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="inDesignMode">Flag which indicates if the control is being drawn on the Workspace Designer. (Use this flag to determine if code should perform any logic on the workspace record)</param>
/// <param name="RecordContext">The current workspace record context.</param>
public BulkImportAddin(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext)
{
// do nothing so framework won't throw exception once it gets to GetControl
if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin)
{
// do nothing
}
else
{
_gContext = globalContext;
_recordContext = recordContext;
bulkImportControl = new BulkImportControl(new Proxy(this));
_Model = bulkImportControl._Model;
_Model.InDesignMode = inDesignMode;
var elementHost = new ElementHost
{
Dock = DockStyle.Fill,
Child = bulkImportControl,
};
Controls.Add(elementHost);
if (inDesignMode)
{
return;
}
//Get configuration
ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext);
_usr = ConfigurationSetting.username;
_pwd = ConfigurationSetting.password;
_client = ConfigurationSetting.client;
_rnSrv = ConfigurationSetting.rnSrv;
Accelerator.EBS.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.EBSProvider;
Accelerator.EBS.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL;
Accelerator.EBS.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
Accelerator.EBS.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
Accelerator.EBS.SharedServices.ContactModel.InitEBSProvider();
Accelerator.EBS.SharedServices.RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider;
Accelerator.EBS.SharedServices.RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL;
Accelerator.EBS.SharedServices.RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL;
Accelerator.EBS.SharedServices.RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL;
Accelerator.EBS.SharedServices.RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL;
Accelerator.EBS.SharedServices.RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL;
Accelerator.EBS.SharedServices.RepairOrder.ServiceUsername = ConfigurationSetting.username;
Accelerator.EBS.SharedServices.RepairOrder.ServicePassword = ConfigurationSetting.password;
Accelerator.EBS.SharedServices.RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
Accelerator.EBS.SharedServices.RepairOrder.InitEBSProvider();
_Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId;
_recordContext.DataLoaded += _rContext_DataLoaded;
_recordContext.Closing += _recordContext_Closing;
_recordContext.Saving += _recordContext_Saving;
_gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged;
}
}
示例2: SetTaskPaneViewModel
public void SetTaskPaneViewModel(ViewModelBase vm)
{
if (TaskPane == null)
{
TaskPaneControl = new TreemapView((TreemapViewModel)vm);
ElementHost host = new ElementHost { Child = TaskPaneControl };
host.Dock = DockStyle.Fill;
UserControl userControl = new UserControl();
userControl.BackColor = Color.White;
userControl.Controls.Add(host);
TaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(userControl, "Treemap");
TaskPane.VisibleChanged += (sender, e) =>
{
if (!TaskPane.Visible)
{
TreemapViewModel tvm = (TreemapViewModel)TaskPaneControl.DataContext;
tvm.IsDead = true;
}
};
}
else
{
TaskPaneControl.DataContext = vm;
}
TaskPane.Width = 400;
TaskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
TaskPane.Visible = true;
}
示例3: DisplayWpfElement
public static OutputPanel DisplayWpfElement(UIElement e, string panelTitle)
{
ElementHost c = new ElementHost {
Child = e
};
return DisplayControl(c, panelTitle);
}
示例4: DashboardMainForm
public DashboardMainForm()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Configuration.GetNewInstance().Settings.Language);
InitializeComponent();
if (System.Windows.Application.Current == null) new System.Windows.Application();
host = new ElementHost();
host.Dock = DockStyle.Fill;
this.toolStripContainer1.ContentPanel.Controls.Add(host);
htmlOutputPath = string.Empty;
dashboard = new EpiDashboard.DashboardControl();
dashboard.DashboardHelperRequested += new EpiDashboard.DashboardHelperRequestedHandler(dashboard_DashboardHelperRequested);
dashboard.RelatedDataRequested += new EpiDashboard.RelatedDataRequestedHandler(dashboard_RelatedDataRequested);
dashboard.HTMLGenerated += new EpiDashboard.HTMLGeneratedHandler(dashboard_HTMLGenerated);
dashboard.RecordCountChanged += new EpiDashboard.RecordCountChangedHandler(dashboard_RecordCountChanged);
dashboard.CanvasChanged += new EpiDashboard.CanvasChangedHandler(dashboard_CanvasChanged);
this.FormClosed += new FormClosedEventHandler(DashboardMainForm_FormClosed);
host.Child = dashboard;
this.Width++;
this.Width--;
this.toolStripContainer1.TopToolStripPanel.Visible = false;
this.Text = SharedStrings.DASHBOARD_TITLE;
}
示例5: TestNewImplementation_ElementHostInputParameter
public void TestNewImplementation_ElementHostInputParameter()
{
var innerValue = new ElementHost();
var result = _decodeNullObject.DecodeNullObjectNewImplementation<ElementHost>(innerValue);
Assert.AreEqual(innerValue, result);
}
示例6: openShortnDialog
/// <summary>
/// Open the Shortn dialog window. Used internally after the Shortn button is pressed, and by Ribbon for the debugging
/// </summary>
/// <param name="data"></param>
public static void openShortnDialog(ShortnData data)
{
System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
newForm.Width = 1200;
newForm.Height = int.MaxValue;
newForm.BackColor = System.Drawing.Color.White;
// Create the ElementHost control for hosting the
// WPF UserControl.
ElementHost host = new ElementHost();
host.Dock = System.Windows.Forms.DockStyle.Fill;
// Create the WPF UserControl.
ShortnDialog sd = new ShortnDialog(data);
// Assign the WPF UserControl to the ElementHost control's
// Child property.
host.Child = sd;
newForm.Visible = false;
// Add the ElementHost control to the form's
// collection of child controls.
newForm.Controls.Add(host);
newForm.Show();
// set the form's height based on what the textbox wants to be
int dialogHeight = (int)sd.grid.DesiredSize.Height;
newForm.Height = (int)(sd.DesiredSize.Height + newForm.Padding.Vertical + System.Windows.Forms.SystemInformation.CaptionHeight + System.Windows.SystemParameters.ScrollWidth);
sd.grid.Height = sd.grid.DesiredSize.Height;
newForm.Width = 1200;
host.MaximumSize = new System.Drawing.Size(1200, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
newForm.Visible = true;
}
示例7: FormEffectEditor
public FormEffectEditor(TimedSequenceEditorForm sequenceEditorForm)
{
if (Application.Current == null)
{
// create the Application object
new Application();
}
ResourceDictionary dict = new ResourceDictionary
{
Source = new Uri("/EffectEditor;component/Themes/Theme.xaml", UriKind.Relative)
};
Application.Current.Resources.MergedDictionaries.Add(dict);
InitializeComponent();
_sequenceEditorForm = sequenceEditorForm;
host = new ElementHost { Dock = DockStyle.Fill };
_effectPropertyEditorGridEffectEffectPropertiesEditor = new EffectPropertyEditorGrid
{
ShowReadOnlyProperties = true,
PropertyFilterVisibility = Visibility.Hidden
};
_effectPropertyEditorGridEffectEffectPropertiesEditor.KeyDown += Editor_OnKeyDown;
host.Child = _effectPropertyEditorGridEffectEffectPropertiesEditor;
Controls.Add(host);
sequenceEditorForm.TimelineControl.SelectionChanged += timelineControl_SelectionChanged;
_effectPropertyEditorGridEffectEffectPropertiesEditor.PropertyValueChanged += EffectPropertyEditorValueChanged;
_effectPropertyEditorGridEffectEffectPropertiesEditor.PreviewChanged += EditorPreviewStateChanged;
_previewLoopTimer.Elapsed += PreviewLoopTimerOnElapsed;
}
示例8: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
// Create the ElementHost control.
_elemHost = new ElementHost {Dock = DockStyle.Fill};
Controls.Add(_elemHost);
// Create a Windows Presentation Foundation Button element
// and assign it as the ElementHost control's child.
var wpfButton = new Button {Content = "Windows Presentation Foundation Button"};
_elemHost.Child = wpfButton;
// Map the Margin property.
AddMarginMapping();
// Remove the mapping for the Cursor property.
RemoveCursorMapping();
// Add a mapping for the Region property.
AddRegionMapping();
// Add another mapping for the BackColor property.
ExtendBackColorMapping();
// Cause the OnMarginChange delegate to be called.
_elemHost.Margin = new Padding(23, 23, 23, 23);
// Cause the OnRegionChange delegate to be called.
_elemHost.Region = new Region();
// Cause the OnBackColorChange delegate to be called.
_elemHost.BackColor = Color.AliceBlue;
}
示例9: VariableInputDialog
public VariableInputDialog(DataType dataType, string prompt)
{
InitializeComponent();
host = new ElementHost();
host.Dock = DockStyle.Fill;
switch (dataType)
{
case DataType.Text:
control = new TextVariableControl();
break;
case DataType.Number:
control = new NumericVariableControl();
break;
case DataType.DateTime:
control = new DateVariableControl();
break;
case DataType.Boolean:
control = new BooleanVariableControl();
break;
default:
control = new TextVariableControl();
break;
}
if (control != null)
{
host.Child = control;
((IVariableControl)control).VariableResultSet += new VariableDialogResultHandler(VariableInputDialog_VariableResultSet);
((IVariableControl)control).Prompt = prompt;
this.Controls.Add(host);
}
}
示例10: General
public General()
{
ElementHost host = new ElementHost();
host.Dock = DockStyle.Fill;
host.Child = panel = new GeneralOptionsPanel();
this.Controls.Add(host);
}
示例11: FrmViewer
private FrmViewer(long tweetId, List<MediaInfo> lst)
{
this.m_lst = lst;
this.m_containsVideo = lst.Exists(e => e.MediaType == MediaTypes.Video);
this.TweetId = tweetId;
InitializeComponent();
this.Text = "[ 0 / 0 ] Azpe";
this.SuspendLayout();
this.m_pic = new ImageViwer();
this.m_pic.Dock = DockStyle.Fill;
this.m_pic.Visible = false;
this.Controls.Add(this.m_pic);
if (this.m_containsVideo)
{
this.m_media = new VideoViewer();
this.m_host = new ElementHost();
this.m_host.Visible = false;
this.m_host.Dock = DockStyle.Fill;
this.m_host.Child = this.m_media;
this.Controls.Add(this.m_host);
}
this.ResumeLayout(false);
lst.ForEach(e => { e.SetParent(this); e.StartDownload(); });
if (Settings.Left != -1) this.Left = Settings.Left;
if (Settings.Top != -1) this.Top = Settings.Top;
if (Settings.Width != -1) this.Width = Settings.Width;
if (Settings.Height != -1) this.Height = Settings.Height;
}
示例12: InitializeComponent
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
protected void InitializeComponent()
{
this._elementHost1 = new System.Windows.Forms.Integration.ElementHost();
this._spatialViewerControl = new SpatialViewer_GDIHost();
_form = new System.Windows.Forms.Form();
_form.SuspendLayout();
//
// elementHost1
//
this._elementHost1.Dock = System.Windows.Forms.DockStyle.Fill;
this._elementHost1.Location = new System.Drawing.Point(0, 0);
this._elementHost1.Name = "elementHost1";
this._elementHost1.Size = new System.Drawing.Size(824, 581);
this._elementHost1.TabIndex = 0;
this._elementHost1.Text = "elementHost1";
this._elementHost1.Child = (UIElement)this._spatialViewerControl;
//
// Form1
//
_form.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
_form.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
_form.ClientSize = new System.Drawing.Size(824, 581);
_form.Controls.Add(this._elementHost1);
_form.Name = "Spatial Toolkit";
_form.Text = "Spatial Toolkit";
_form.ResumeLayout(false);
}
示例13: EditorControl
//public string SoapAction { get; set; }
public EditorControl()
{
var host = new ElementHost();
host.Size = new Size(200, 100);
host.Location = new Point(100, 100);
host.Dock = DockStyle.Fill;
_editor = new ICSharpCode.AvalonEdit.TextEditor();
_editor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
_editor.FontSize = 12.0;
_editor.Options.ConvertTabsToSpaces = true;
_editor.Options.EnableRectangularSelection = true;
_editor.Options.IndentationSize = 2;
_editor.ShowLineNumbers = true;
_editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinitionByExtension(".xml");
_editor.TextArea.TextEntering += TextArea_TextEntering;
_editor.TextArea.TextEntered += TextArea_TextEntered;
_editor.TextArea.KeyDown += TextArea_KeyDown;
host.Child = _editor;
_editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
_foldingManager = FoldingManager.Install(_editor.TextArea);
UpdateFoldings();
var foldingUpdateTimer = new DispatcherTimer();
foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
foldingUpdateTimer.Tick += delegate { UpdateFoldings(); };
foldingUpdateTimer.Start();
this.Controls.Add(host);
}
示例14: addCodeFile
private void addCodeFile(File File)
{
TabPage Page = new TabPage();
Page.Text = File.Name;
CheckBox IsCritical = new CheckBox();
IsCritical.Visible = false;
IsCritical.Checked = File.Critical;
Page.Controls.Add(IsCritical);
TextEditor TextBox = new TextEditor();
TextBox.ShowLineNumbers = true;
TextBox.FontSize = 14;
TextBox.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#");
TextBox.TextArea.TextEntered +=new System.Windows.Input.TextCompositionEventHandler(TextEntered);
TextBox.TextArea.TextEntering += new System.Windows.Input.TextCompositionEventHandler(AutocompleteEntering);
ElementHost Host = new ElementHost();
Host.Child = TextBox;
Host.Location = new Point(3, 3);
Host.Size = new Size(Page.Size.Width - 6, Page.Size.Height - 6);
Host.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
Page.Controls.Add(Host);
codeTabControl.TabPages.Add(Page);
codeTextboxes.Add(TextBox);
TextBox.Text = File.Code;
}
示例15: EditorControl
//public string SoapAction { get; set; }
public EditorControl()
{
var host = new ElementHost();
host.Size = new Size(200, 100);
host.Location = new Point(100, 100);
host.Dock = DockStyle.Fill;
_extEditor = new ExtendedEditor();
var editor = _extEditor.editor;
editor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
editor.FontSize = 12.0;
editor.Options.ConvertTabsToSpaces = true;
editor.Options.EnableRectangularSelection = true;
editor.Options.IndentationSize = 2;
editor.ShowLineNumbers = true;
editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinitionByExtension(".xml");
editor.TextArea.TextEntering += TextArea_TextEntering;
editor.TextArea.TextEntered += TextArea_TextEntered;
editor.TextArea.KeyDown += TextArea_KeyDown;
host.Child = _extEditor;
editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
this.Controls.Add(host);
}