Пример #1
1
        /// <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
0
        //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);
        }
        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;
        }
        public void TestNewImplementation_ElementHostInputParameter()
        {
            var innerValue = new ElementHost();
            var result = _decodeNullObject.DecodeNullObjectNewImplementation<ElementHost>(innerValue);

            Assert.AreEqual(innerValue, result);
        }
Пример #5
0
        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;
        }
Пример #6
0
        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;
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of class CodeControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public CodeControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            textEditor = new TextEditor
            {
                ShowLineNumbers = true,
                FontSize = 12,
                FontFamily = new System.Windows.Media.FontFamily("Consolas"),
                //Focusable = true,
                //IsHitTestVisible = true
            };

            var wpfHost = new ElementHost
            {
                Child = textEditor,
                Dock = DockStyle.Fill,
                BackColorTransparent = true,
            };

            Controls.Add(wpfHost);

            if (!string.IsNullOrEmpty(content))
            {
                // Converts base64 content to string
                byte[] b = Convert.FromBase64String(content);
                innerContent = System.Text.Encoding.UTF8.GetString(b);
                originalContent = innerContent;
                innerType = type;
            }
        }
Пример #8
0
		public General()
		{
			ElementHost host = new ElementHost();
			host.Dock = DockStyle.Fill;
			host.Child = panel = new GeneralOptionsPanel();
			this.Controls.Add(host);
		}
Пример #9
0
        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;
        }
Пример #10
0
        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;
        }
Пример #11
0
        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;
        }
Пример #12
0
        /// <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;
        }
Пример #13
0
        //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);
        }
		/// <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);

		}
Пример #15
0
        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);
            }
        }
Пример #16
0
 public static OutputPanel DisplayWpfElement(UIElement e, string panelTitle)
 {
     ElementHost c = new ElementHost {
         Child = e
     };
     return DisplayControl(c, panelTitle);
 }
Пример #17
0
 /// <summary>
 /// Initializes an instance of a browser element.
 /// </summary>
 /// <param name="element"> The browser element this is for. </param>
 /// <param name="browser"> The browser this element is associated with. </param>
 /// <param name="parent"> </param>
 protected WebElement(JToken element, Browser browser, ElementHost parent)
     : base(browser.Application, parent)
 {
     Browser = browser;
     _element = element;
     _originalColor = GetStyleAttributeValue("backgroundColor", false) ?? "";
     _highlightColor = "yellow";
 }
 //ClassicReportDocument doc;
 public XpsPreviewControl()
 {
     InitializeComponent();
     viewer = new DocumentViewer();
     host = new ElementHost();
     host.Dock = System.Windows.Forms.DockStyle.Fill;
     host.Child = viewer;
     Controls.Add(host);
 }
Пример #19
0
 public CertInspector()
 {
     _rootStore.Open(OpenFlags.ReadOnly);
     _userStore.Open(OpenFlags.ReadOnly);
     _host = new ElementHost {Dock = DockStyle.Fill};
     _panel = new StackPanel();
     _host.Child = new ScrollViewer { Content = _panel };
     FiddlerApplication.Prefs.AddWatcher("fiddler.ui.font", FontChanged);
 }
 public ZoomPreviewControl()
 {
     InitializeComponent();
     _host = new ElementHost();
     _scale = new ScaleTransform();
     _host.Dock = System.Windows.Forms.DockStyle.Fill;
     Controls.Add(_host);
     _host.BringToFront();
 }
Пример #21
0
        public StatCalc(Calculators calculator)
        {
            InitializeComponent();

            host = new ElementHost();
            host.Dock = DockStyle.Fill;
            switch (calculator)
            {
                case Calculators.TwoByTwo:
                    control = new EpiDashboard.StatCalc.TwoByTwo();
                    break;
                case Calculators.PopulationSurvey:
                    control = new EpiDashboard.StatCalc.PopulationSurvey();
                    break;
                case Calculators.Poisson:
                    control = new EpiDashboard.StatCalc.Poisson();
                    break;
                case Calculators.Binomial:
                    control = new EpiDashboard.StatCalc.Binomial();
                    break;
                case Calculators.UnmatchedCaseControl:
                    control = new EpiDashboard.StatCalc.UnmatchedCaseControl();
                    break;
                case Calculators.Cohort:
                    control = new EpiDashboard.StatCalc.Cohort();
                    break;
                case Calculators.ChiSquareForTrend:
                    control = new EpiDashboard.StatCalc.ChiSquareControl();
                    //((EpiDashboard.StatCalc.ChiSquareControl)control).SizeChanged += new System.Windows.SizeChangedEventHandler(StatCalc_SizeChanged);
                    break;
                case Calculators.MatchedPairCaseControl:
                    control = new EpiDashboard.Gadgets.StatCalc.MatchedPairCaseControlGadget();
                    (control as EpiDashboard.Gadgets.StatCalc.MatchedPairCaseControlGadget).IsHostedInOwnWindow = true;
                    break;
                default:
                    break;
            }
            if (control != null)
            {
                if (control is EpiDashboard.StatCalc.IStatCalcControl)
                {
                    host.Child = control;
                    this.Controls.Add(host);
                    this.Width = ((EpiDashboard.StatCalc.IStatCalcControl)control).PreferredUIWidth;
                    this.Height = ((EpiDashboard.StatCalc.IStatCalcControl)control).PreferredUIHeight + 10;
                    ((EpiDashboard.StatCalc.IStatCalcControl)control).HideCloseIcon();
                }
                else if (control is EpiDashboard.Gadgets.IStatCalcControl)
                {
                    host.Child = control;
                    this.Controls.Add(host);
                    this.Width = ((EpiDashboard.Gadgets.IStatCalcControl)control).PreferredUIWidth;
                    this.Height = ((EpiDashboard.Gadgets.IStatCalcControl)control).PreferredUIHeight + 10;
                }
            }
        }
Пример #22
0
        public answerQuerieForm(int playerid, string playername, ServiceClient Server,int questionnum)
        {
            InitializeComponent();
            comboBox1.Visible = false;
            label1.Visible = false;
            elementHost = new ElementHost();
            this.playerId = playerid;
            this.playerName = playername;
            this.server = Server;
            this.questionNum = questionnum;
            editFlag = true;
            manualResetEvent = new ManualResetEvent(true);
            
            
            SuspendLayout();
            switch (questionnum)
            {
                case 1:
                    question1();
                    break;
                case 2:
                    question2();
                    break;
                case 3:
                    question3();
                    break;
                    
                case 4:
                    question4();
                    break;
                case 5:
                    question5();
                    break;
                case 6:
                    question6();
                    break;
                case 7:
                    question7();
                    break;

                case 8:
                    question8();
                    break;
                case 9:
                    question9();
                    break;
                case 10:
                    question10();
                    break;
            }
            ResumeLayout(false);




        }
Пример #23
0
 public override void AddToTab(TabPage o)
 {
     o.Text = "Certificates";
     var host = new ElementHost();
     host.Dock = DockStyle.Fill;
     var stackPanel = new StackPanel();
     host.Child = new ScrollViewer { Content = stackPanel };
     o.Controls.Add(host);
     _panel = stackPanel;
 }
        public WindowsFormContainer()
        {
            InitializeComponent();

            _mainView = new Views.MainWindow(); //Create Instance of WPF View
            _elementHost = new ElementHost();   //Create ElementHost (System.Windows.Forms.Integration)
            _elementHost.Child = _mainView;     //Set our WPF View as elementhost.child.
            this.Controls.Add(_elementHost);    //Add elementhost to form controls collection.
            FormatWindow();                     //I haven't found a better way to do this yet.
        }
Пример #25
0
 /// <summary>
 ///     Standard constructor for the tool window.
 /// </summary>
 public ExplorerWindow(IXmlDesignerPackage package)
     : base(null)
 {
     _package = package;
     _elementHost = new ElementHost();
     _elementHost.BackColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
     VSColorTheme.ThemeChanged += OnColorThemeChanged;
     _package.ModelManager.ModelChangesCommitted += OnModelChangesCommitted;
     _package.FileNameChanged += OnFileNameChanged;
 }
Пример #26
0
		private void Initilize()
		{
			_comboBox = new WpfComboBox();
			_elementHost = new ElementHost();
			Controls.Add(_elementHost);
			_elementHost.Child = _comboBox;
			_elementHost.AutoSize = false;
			_comboBox.Host.DropDownOpened += Host_DropDownOpened;
			_comboBox.Host.SelectionChanged += Host_SelectionChanged;
			InitilizeComponent();
		}
Пример #27
0
        public ControlContainer(ElementHost _uc, string _name, MainForm _mainForm)
        {
            InitializeComponent();

            this.Text = _name;
            this.Name = _name;
            this.MdiParent = _mainForm;

            _uc.Dock = DockStyle.Fill;
            this.Controls.Add(_uc);
        }
Пример #28
0
 public CertInspector()
 {
     _askUpdateBarModel = new AskUpdateBarModel();
     _rootStore.Open(OpenFlags.ReadOnly);
     _userStore.Open(OpenFlags.ReadOnly);
     _host = new ElementHost { Dock = DockStyle.Fill };
     _panel = new Grid();
     _host.Child = _panel;
     FiddlerApplication.Prefs.AddWatcher("fiddler.ui.font", FontChanged);
     FiddlerApplication.Prefs.AddWatcher(PreferenceNames.ASK_CHECK_FOR_UPDATES_PREF, AskUpdateChanged);
 }
Пример #29
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override System.Windows.Forms.Control CreateControlPane()
        {
            //create an ElementHost
              ElementHost eh = new ElementHost();
              eh.AutoSize = true;
              eh.Child = new Navis2JiraWin();
              eh.CreateControl();

              //return the ElementHost
              return eh;
        }
Пример #30
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection)
		{
			m_host = new ElementHost();
			m_host.Dock = DockStyle.Fill;
			this.Controls.Add(m_host);

			m_universe = new Universe(connection, m_host);
			m_host.Child = m_universe;
			this.Text = Utilities.GetStandardCaption(connection);
			return true;
		}
Пример #31
0
 public LineListingViewer(View view, IDbDriver db, string title)
 {
     try
     {
         InitializeComponent();
         host      = new ElementHost();
         host.Dock = DockStyle.Fill;
         control   = new EpiDashboard.SimpleDataGrid(view, db);
         control.RecordSelected += new EpiDashboard.Mapping.RecordSelectedHandler(control_RecordSelected);
         host.Child              = control;
         this.Controls.Add(host);
         this.Text  += " - " + title;
         this.Shown += new EventHandler(LineListingViewer_Shown);
     }
     catch (Exception ex)
     {
         //catching all for debugging purposes
     }
 }
Пример #32
0
        /// <summary>
        /// Called when Fiddler User Interface is fully available
        /// </summary>
        public void OnLoad()
        {
            /* Load our UI: FeederNetInspector tab */
            TabPage page = new TabPage("FeederNetInspector");

            page.ImageIndex = (int)Fiddler.SessionIcons.Inspector;
            FiddlerApplication.UI.tabsViews.TabPages.Add(page);

            ElementHost element = new ElementHost();

            container     = new Container();
            element.Child = container;
            element.Dock  = DockStyle.Fill;

            page.Controls.Add(element);

            //Register an event handdler to CalculateReport event
            FiddlerApplication.CalculateReport += new CalculateReportHandler(DisplayResults);
        }
Пример #33
0
        public void ShowNotification(Guid id, string title, string message, NotificationType?type = NotificationType.Simple)
        {
            var notification = new Notification(title, message, id, notifications.Count + 1, type);

            var qtdNotifications = notifications.Count;
            var workArea         = System.Windows.SystemParameters.WorkArea;

            notification.Left = workArea.Right - notification.Width - 10;
            notification.Top  = workArea.Bottom - ((notification.Height + 10) * (qtdNotifications + 1));

            notification.OnClose += OnCloseNotification;

            notifications.Add(notification);

            //https://social.msdn.microsoft.com/Forums/vstudio/en-US/c68d5f3c-c8cc-427d-82e3-6135d075a304/bug-in-nonwpfwpf-mixapplications?forum=wpf
            ElementHost.EnableModelessKeyboardInterop(notification);

            notification.Show();
        }
Пример #34
0
        public override Control CreateControlPane()
        {
            //create an ElementHost
            ElementHost eh = new ElementHost();



            //assign the control
            //eh.Anchor = AnchorStyles.Top;
            eh.Dock           = DockStyle.Top;
            eh.Anchor         = AnchorStyles.Top;
            ns                = new NavisWindow();
            eh.Child          = ns;
            eh.HandleCreated += eh_HandleCreated;
            eh.CreateControl();

            //return the ElementHost
            return(eh);
        }
 private void QRCodeItem_Click(object sender, EventArgs e)
 {
     if (serverSharingWindow == null)
     {
         serverSharingWindow = new System.Windows.Window()
         {
             Title     = LocalizationProvider.GetLocalizedValue <string>("ServerSharing"),
             Height    = 400,
             Width     = 660,
             MinHeight = 400,
             MinWidth  = 660,
             Content   = new ServerSharingView()
         };
         serverSharingWindow.Closed += ServerSharingWindow_Closed;
         ElementHost.EnableModelessKeyboardInterop(serverSharingWindow);
         serverSharingWindow.Show();
     }
     serverSharingWindow.Activate();
 }
        public IProfileType QueryProfileType(IReadOnlyCollection <IProfileType> profileTypes)
        {
            var viewModel = new SelectProfileViewModel(profileTypes, this);

            var window = new SelectProfileWindow();

            window.DataContext = viewModel;
            window.Icon        = BitmapFrame.Create(new Uri("pack://application:,,,/CalDavSynchronizer;component/Resources/ApplicationIcon.ico"));
            ElementHost.EnableModelessKeyboardInterop(window);

            if (window.ShowDialog() ?? false)
            {
                return(viewModel.SelectedProfile);
            }
            else
            {
                return(null);
            }
        }
 private void OnlineConfig_Click(object sender, EventArgs e)
 {
     if (onlineConfigWindow == null)
     {
         onlineConfigWindow = new System.Windows.Window()
         {
             Title     = LocalizationProvider.GetLocalizedValue <string>("OnlineConfigDelivery"),
             Height    = 510,
             Width     = 480,
             MinHeight = 510,
             MinWidth  = 480,
             Content   = new OnlineConfigView()
         };
         onlineConfigWindow.Closed += OnlineConfigWindow_Closed;
         ElementHost.EnableModelessKeyboardInterop(onlineConfigWindow);
         onlineConfigWindow.Show();
     }
     onlineConfigWindow.Activate();
 }
 private void hotKeyItem_Click(object sender, EventArgs e)
 {
     if (hotkeysWindow == null)
     {
         hotkeysWindow = new System.Windows.Window()
         {
             Title     = LocalizationProvider.GetLocalizedValue <string>("Hotkeys"),
             Height    = 260,
             Width     = 320,
             MinHeight = 260,
             MinWidth  = 320,
             Content   = new HotkeysView()
         };
         hotkeysWindow.Closed += HotkeysWindow_Closed;
         ElementHost.EnableModelessKeyboardInterop(hotkeysWindow);
         hotkeysWindow.Show();
     }
     hotkeysWindow.Activate();
 }
Пример #39
0
        public KagamiOverlayConfigPanel(KagamiOverlay overlay)
        {
            this.InitializeComponent();
            this.Dock = DockStyle.Fill;

            this.Load += (_, __) =>
            {
                var view = new KagamiConfigView();
                view.ViewModel.Config = overlay.Config;

                var elementHost = new ElementHost()
                {
                    Dock  = DockStyle.Fill,
                    Child = view
                };

                this.Controls.Add(elementHost);
            };
        }
 private void proxyItem_Click(object sender, EventArgs e)
 {
     if (forwardProxyWindow == null)
     {
         forwardProxyWindow = new System.Windows.Window()
         {
             Title     = LocalizationProvider.GetLocalizedValue <string>("ForwardProxy"),
             Height    = 400,
             Width     = 280,
             MinHeight = 400,
             MinWidth  = 280,
             Content   = new ForwardProxyView()
         };
         forwardProxyWindow.Closed += ForwardProxyWindow_Closed;
         ElementHost.EnableModelessKeyboardInterop(forwardProxyWindow);
         forwardProxyWindow.Show();
     }
     forwardProxyWindow.Activate();
 }
Пример #41
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _wpfElementHost      = new ElementHost();
            _wpfElementHost.Dock = DockStyle.Fill;
            this.Controls.Add(_wpfElementHost);


            var appFolder = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            var fileName = Path.Combine(appFolder, "XICSM_ICSControlClient\\Xaml\\ICSControlClient.xaml");

            using (var fileStream = new FileStream(fileName, FileMode.Open))
            {
                this._wpfElementHost.Child = (UIElement)XamlReader.Load(fileStream);
                (this._wpfElementHost.Child as System.Windows.Controls.UserControl).DataContext = new ControlClientViewModel();
            }
            //_wpfControl = new MainFormWpfControl();
            //this._wpfElementHost.Child = _wpfControl;
        }
Пример #42
0
        private void RefreshGroup(List <Model.Curve> list)
        {
            List <Model.Curve> g1list = list.FindAll(new Predicate <Model.Curve>((obj) => { return(obj.CurveGroupIndex == 0); }));
            List <Model.Curve> g2list = list.FindAll(new Predicate <Model.Curve>((obj) => { return(obj.CurveGroupIndex == 1); }));
            List <Model.Curve> g3list = list.FindAll(new Predicate <Model.Curve>((obj) => { return(obj.CurveGroupIndex == 2); }));

            for (int i = 0; i < g1list.Count; i++)
            {
                ElementHost host = new ElementHost();
                hosts.Add(host);
                host.Height = 36;
                WPFGraph.ParaTable pt = new WPFGraph.ParaTable();
                pt.SetCurve(g1list[i]);
                host.Child = pt;
                host.Tag   = g1list[i].Id;
                host.Dock  = DockStyle.Top;
                PL_G1.Controls.Add(host);
            }
            for (int i = 0; i < g2list.Count; i++)
            {
                ElementHost host = new ElementHost();
                hosts.Add(host);
                host.Height = 36;
                WPFGraph.ParaTable pt = new WPFGraph.ParaTable();
                pt.SetCurve(g2list[i]);
                host.Tag   = g2list[i].Id;
                host.Child = pt;
                host.Dock  = DockStyle.Top;
                PL_G2.Controls.Add(host);
            }
            for (int i = 0; i < g3list.Count; i++)
            {
                ElementHost host = new ElementHost();
                hosts.Add(host);
                host.Height = 36;
                WPFGraph.ParaTable pt = new WPFGraph.ParaTable();
                pt.SetCurve(g3list[i]);
                host.Child = pt;
                host.Tag   = g3list[i].Id;
                host.Dock  = DockStyle.Top;
                PL_G3.Controls.Add(host);
            }
        }
Пример #43
0
        private void f_LoadWrapPanel(int numThumbs)
        {
            if (p_IsWPF == false)
            {
                return;
            }
            this.Text = "WPF";
            ITCWrapPanel wp = new ITCWrapPanel();

            p_WrapPanel       = new ElementHost();
            p_WrapPanel.Child = wp;
            p_WrapPanel.Dock  = DockStyle.Fill;
            this.Controls.Add(p_WrapPanel);

            for (int i = 0; i < numThumbs; ++i)
            {
                f_AddSingleWPFThumbControl(wp.p_ITCList);
            }
        }
Пример #44
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            ctrlHost      = new ElementHost();
            ctrlHost.Dock = DockStyle.Fill;
            pnl.Controls.Add(ctrlHost);
            wpfCtrl = new ucMain();
            // wpfCtrl.InitializeComponent();
            ctrlHost.Child = wpfCtrl;

            wpfCtrl.OnButtonClick += new ucMain.MyControlEventHandler(Ctrl_OnButtonClick);



            wpfCtrl.OnButtonResetClick += new ucMain.MyButtonResetEventHandler(Ctrl_OnButtonResClick);

            this.wpfCtrl.SubjectTopicList = Globals.ThisAddIn.SubjectTopicList;

            this.wpfCtrl.reset();
        }
Пример #45
0
    private static void newThread()
    {
        String path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\animate.mp4";

        if (!File.Exists(path))
        {
            Console.WriteLine("File does not exist at path " + path);
            Console.Read();
            return;
        }

        Form f = new Form
        {
            Size            = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height),
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None,
        };

        MediaElement me = new MediaElement()
        {
            Name           = "mediaElement1",
            Height         = f.Height,
            Width          = f.Width,
            Source         = new Uri(path),
            Stretch        = System.Windows.Media.Stretch.UniformToFill,
            LoadedBehavior = MediaState.Manual,
        };

        me.MediaEnded += new System.Windows.RoutedEventHandler(mediaEnded);

        ElementHost host = new ElementHost();

        host.Dock              = DockStyle.Fill;
        host.Child             = me;
        me.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

        f.Controls.Add(host);
        me.Play();

        Win32.setOwnership(f);

        Application.EnableVisualStyles();
        Application.Run(f);
    }
Пример #46
0
        private static void Show(Window window)
        {
            ExcelAsyncUtil.QueueAsMacro(() =>
            {
                if (Application.Current == null)
                {
                    new Application().ShutdownMode = ShutdownMode.OnExplicitShutdown;
                }

                ElementHost.EnableModelessKeyboardInterop(window);

                if (Application.Current != null)
                {
                    Application.Current.MainWindow = window;
                }

                window.Show();
            });
        }
        public void Start()
        {
            _paletteSet       = new PaletteSet("MP: Свойства примитивов ModPlus", new Guid("756d08d2-fa22-4496-aae6-73d5e98ab722"));
            _paletteSet.Load += _paletteSet_Load;
            _paletteSet.Save += _paletteSet_Save;
            PropertiesPalette propertiesPalette = new PropertiesPalette();
            ElementHost       elementHost       = new ElementHost()
            {
                AutoSize = true,
                Dock     = DockStyle.Fill,
                Child    = propertiesPalette
            };

            _paletteSet.Add("Свойства примитивов ModPlus", elementHost);
            _paletteSet.Style       = PaletteSetStyles.ShowCloseButton | PaletteSetStyles.ShowPropertiesMenu | PaletteSetStyles.ShowAutoHideButton;
            _paletteSet.MinimumSize = new Size(100, 300);
            _paletteSet.DockEnabled = DockSides.Right | DockSides.Left;
            _paletteSet.Visible     = true;
        }
Пример #48
0
        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                Connection_Flag = false;
                SP.PortName     = comboBox2.SelectedItem.ToString();
                SP.BaudRate     = int.Parse(comboBox3.SelectedItem.ToString());
                SP.Open();
                String at_commands = "AT+RCPIN =" + textBox3.Text;
                SP.WriteLine(at_commands + (Char)13);

                Properties.Settings.Default.Map_URI = textBox2.Text;
                Properties.Settings.Default.Save();

                if (Properties.Settings.Default.Map_URI != "")
                {
                    ctrlHost      = new ElementHost();
                    ctrlHost.Dock = DockStyle.Fill;
                    pnl_Map.Controls.Add(ctrlHost);

                    _esri_MAP = new SYSTEL_ESRI_Control.SYSTEL_ESRI_Main_Control("lriRsrLANJyLeDDu", "runtimestandard,101," + "rud336290293" + ",none,GB1P0H4EN96HF5KHT247");

                    _esri_MAP.InitializeComponent();
                    ctrlHost.Child = _esri_MAP;
                    _esri_MAP.Add_Online_Map_Layer("Main_Map", Properties.Settings.Default.Map_URI);

                    SYSTEL_ESRI_Control.SYSTEL_ESRI_Main_Control.MapPoint_Position Map_Point_Obj = new SYSTEL_ESRI_Control.SYSTEL_ESRI_Main_Control.MapPoint_Position();
                    Map_Point_Obj.Latitude  = 26.869798;
                    Map_Point_Obj.Longitude = 30.670388;
                    _esri_MAP.Fly_To(Map_Point_Obj, 10000000);

                    _esri_MAP.Send_DroppedMapPoint_Info   += _esri_MAP_Send_DroppedMapPoint_Info;
                    _esri_MAP.Send_MAP_ExtentChanged_Info += _esri_MAP_Send_MAP_ExtentChanged_Info;
                    _esri_MAP.Send_TappedMapPoint_Info    += _esri_MAP_Send_TappedMapPoint_Info;
                }
            }
            catch (Exception ex)
            {
                Auditing.Error(ex.Message);
                pictureBox1_Update(false, true);
            }
        }
Пример #49
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;
            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                switch (dsProperty.OutputDataFormatType)
                {
                case OutputTypes.CSharpCode:
                    IdpeKey          key              = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.CSharpCodeOutputWriter.ToString());
                    string           code             = key != null ? key.Value : string.Empty;
                    CSharpCodeEditor cSharpCodeEditor = new CSharpCodeEditor(code);
                    if (cSharpCodeEditor.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        new Manager().SaveOutputWriterCSharpCode(dsProperty.Id, cSharpCodeEditor.CSharpCodeInformation.RawString);
                        dsProperty.DataSourceKeys = new Manager().GetKeys(dsProperty.Id);
                    }
                    break;

                case OutputTypes.FixedLength:
                    frmOutputWriterFixedLength outputWriterFixedLength = new frmOutputWriterFixedLength(
                        dsProperty.Id, (int)dsProperty.SystemDataSourceId);
                    outputWriterFixedLength.ShowDialog();
                    break;

                case OutputTypes.Database:
                    ConfigDatabaseWriter configDatabaseWriter = new ConfigDatabaseWriter(dsProperty.Id, (int)dsProperty.SystemDataSourceId);
                    ElementHost.EnableModelessKeyboardInterop(configDatabaseWriter);
                    configDatabaseWriter.Show();
                    break;

                case OutputTypes.Custom:
                    return(ShowCustomInterfaceEditor(wfes, dsProperty));

                    break;
                }
            }
            return(value);
        }
Пример #50
0
        public MatrixForm()
        {
            InitializeComponent();

            // fire up the scripting system
            Scripting = new ScriptingEngine();
            Scripting.LoadTools();

            // colourize the hints box for the scripting window
            wHintBox.SelectionLength = 6;
            wHintBox.SelectionColor  = Color.Blue;
            wHintBox.SelectionStart  = wHintBox.Find("FrameSequence");
            wHintBox.SelectionLength = "FrameSequence".Length;
            wHintBox.SelectionColor  = Color.Blue;

            // build the script editor window
            ScriptEditor                    = new TextEditor();
            ScriptEditor.FontFamily         = new System.Windows.Media.FontFamily("Courier New");
            ScriptEditor.FontSize           = 14.0f;
            ScriptEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".cs");
            ScriptEditor.KeyDown           += new System.Windows.Input.KeyEventHandler(avalon_KeyDown);

            // host it (it's WPF)
            ScriptWPFHost       = new ElementHost();
            ScriptWPFHost.Dock  = DockStyle.Fill;
            ScriptWPFHost.Child = ScriptEditor;
            wEditorDock.Controls.Add(ScriptWPFHost);


            TabPage           tb = new TabPage("Pattern 1");
            FrameSequenceView sv = new FrameSequenceView();

            sv.Dock = DockStyle.Fill;
            tb.Controls.Add(sv);
            wSequenceTabs.TabPages.Add(tb);


            Frame t = new Frame();

            sv.Sequence.Add(t, false);
            wFrameEditor.ViewFrame = t;
        }
Пример #51
0
        public void Activate(IntPtr hWndParent, RECT[] rect, int modal)
        {
            _elementHost = new ElementHost()
            {
                Child  = _propertyPageControl,
                Left   = rect[0].left,
                Top    = rect[0].top,
                Width  = rect[0].right - rect[0].left,
                Height = rect[0].bottom - rect[0].top
            };

            var parentControl = Control.FromHandle(hWndParent);

            if (parentControl != null)
            {
                _elementHost.Parent = parentControl;
            }

            SetParent((int)_elementHost.Handle, (int)hWndParent);
        }
Пример #52
0
        //<snippet11>
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create the ElementHost control for hosting the
            // WPF UserControl.
            ElementHost host = new ElementHost();

            host.Dock = DockStyle.Fill;

            // Create the WPF UserControl.
            HostingWpfUserControlInWf.UserControl1 uc =
                new HostingWpfUserControlInWf.UserControl1();

            // Assign the WPF UserControl to the ElementHost control's
            // Child property.
            host.Child = uc;

            // Add the ElementHost control to the form's
            // collection of child controls.
            this.Controls.Add(host);
        }
Пример #53
0
        public void OnLoad()
        {
            //新建UI对象
            container = new Container();

            //新建一个Fiddler插件的page
            TabPage page = new TabPage("PlugExample");

            //将page加入Fiddler的tab选项卡中
            FiddlerApplication.UI.tabsViews.TabPages.Add(page);

            //将WinForm和WPF联系起来(在WinForm中调用WPF)
            ElementHost element = new ElementHost();

            element.Child = container;
            element.Dock  = DockStyle.Fill;

            //将WPF挂载对象添加到page中
            page.Controls.Add(element);
        }
Пример #54
0
        public MapMainForm()
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Configuration.GetNewInstance().Settings.Language);

            InitializeComponent();

            host      = new ElementHost();
            host.Dock = DockStyle.Fill;
            this.Controls.Add(host);

            mapControl = new EpiDashboard.Mapping.StandaloneMapControl();
            mapControl.DataSourceRequested     += new EpiDashboard.Mapping.DataSourceRequestedHandler(mapControl_DataSourceRequested);
            mapControl.MouseCoordinatesChanged += new EpiDashboard.Mapping.MouseCoordinatesChangedHandler(mapControl_MouseCoordinatesChanged);
            mapControl.MapLoaded        += new EpiDashboard.Mapping.MapLoadedHandler(mapControl_MapLoaded);
            mapControl.ExpandRequested  += new EventHandler(mapControl_ExpandRequested);
            mapControl.RestoreRequested += new EventHandler(mapControl_RestoreRequested);
            host.Child = mapControl;
            this.Width++;
            this.Width--;
        }
Пример #55
0
        public void WindowCreated(IWindowInfo window, IEnumerable <KeyValuePair <string, string> > properties)
        {
            var wi = window as MapInfo.Types.WindowInfo;

            if (wi == null)
            {
                return;
            }
            var ctrl = new ElementHost
            {
                Child = wi.UserControl,
                Dock  = DockStyle.Fill
            };

            if (wi.IsDocumentWindow)
            {
                panelMap.Tag = wi.WindowId;
                panelMap.Controls.Add(ctrl);
            }
        }
Пример #56
0
        /// <summary>
        /// Initializes from a WinForms control.
        /// </summary>
        public EitherControl([NotNull] Control control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            // Try unwrapping
            var host = control as ElementHost;

            if (host != null)
            {
                myElement     = host.Child;
                myElementHost = host;
            }
            else
            {
                myControl = control;
            }
        }
Пример #57
0
        public LoginForm(Uri loginUri, Uri targetUri)
        {
            InitializeComponent();

            DialogResult = DialogResult.Cancel;

            _loginControl = new AdnLoginControl(
                loginUri,
                targetUri);

            _loginControl.OnLoginSuccess += OnLoginSuccess;

            ElementHost elementHost = new ElementHost();

            elementHost.Dock = DockStyle.Fill;

            elementHost.Child = _loginControl;

            this.Controls.Add(elementHost);
        }
Пример #58
0
        private async void StartAsync()
        {
            var main = new MainWindow();

            main.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            main.splashControl.Content = new View.Splash();
            ps = new PocketStrafeBootStrapper();
            main.DataContext = new ViewModel.MainViewModel(ps);
            main.contentControl.Visibility = Visibility.Hidden;
            var settings = new View.SettingsView();

            main.contentControl.Content = settings;
            main.Show();

            await Task.Run(() => ps.Start());

            main.splashControl.Visibility  = Visibility.Collapsed;
            main.contentControl.Visibility = Visibility.Visible;
            ElementHost.EnableModelessKeyboardInterop(main);
        }
        /*public static Control getHost(this string xamlFileName)
         * {
         *  if (xamlFileName.fileExists())
         *  { }
         *  return null;
         * }*/
        #region ElementHost add

        public static T add_Control_Wpf <T>(this ElementHost elementHost) where T : UIElement
        {
            return((T)elementHost.invokeOnThread(
                       () => {
                try
                {
                    var wpfControl = typeof(T).ctor();
                    if (wpfControl is UIElement)
                    {
                        elementHost.Child = (UIElement)wpfControl;
                        return (T)wpfControl;
                    }
                }
                catch (System.Exception ex)
                {
                    ex.log("in add_Control");
                }
                return null;
            }));
        }
Пример #60
0
        private void RTEControl_Load(object sender, EventArgs e)
        {
            title.Text = "This is a test";
            ctrlHost   = new ElementHost
            {
                Dock = DockStyle.Fill
            };
            panel2.Controls.Add(ctrlHost);
            rtfEditor = new WpfRichText.RichTextEditor()
            {
                Background      = System.Windows.SystemColors.ControlLightLightBrush,
                Foreground      = System.Windows.SystemColors.ControlTextBrush,
                BorderThickness = new System.Windows.Thickness(1),
                BorderBrush     = System.Windows.SystemColors.MenuBarBrush
            };
            rtfEditor.InitializeComponent();
            ctrlHost.Child = rtfEditor;

            // TODO: saveEntry on textChange event of rtfEditor
        }