Beispiel #1
0
        public Game1(IntPtr drawSurface,
                    System.Windows.Forms.Form parentForm,
                    System.Windows.Forms.PictureBox surfacePictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            this.parentForm = parentForm;
            this.pictureBox = surfacePictureBox;

            graphics.PreparingDeviceSettings +=
                new EventHandler<PreparingDeviceSettingsEventArgs>(
                graphics_PreparingDeviceSettings);

            Mouse.WindowHandle = drawSurface;

            gameForm =
                System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
            pictureBox.SizeChanged += new EventHandler(pictureBox_SizeChanged);

            vscroll =
                (System.Windows.Forms.VScrollBar)parentForm.Controls["vScrollBar1"];
            hscroll =
                (System.Windows.Forms.HScrollBar)parentForm.Controls["hScrollBar1"];

        }
 public GXAsyncWork(System.Windows.Forms.Control sender, AsyncStateChangeEventHandler e, AsyncTransaction command, object[] parameters)
 {
     OnAsyncStateChangeEventHandler = e;
     Sender = sender;
     Command = command;
     Parameters = parameters;
 }
Beispiel #3
0
        /// <summary>
        /// Constructs a ControlScheduler that schedules units of work on the message loop associated with control.
        /// </summary>
        public ControlScheduler(System.Windows.Forms.Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            this.control = control;
        }
Beispiel #4
0
        /// <summary>Move the GoogleEarth's map control to the specified control
        /// Move the GoogleEarth's map control to the specified control
        /// </summary>
        /// <param name="parentControl">The specified control that GoogleEarth's map control will be moved to.</param>
        /// <param name="geApplication">The application which will be moved to the specified control. </param>
        public void SetGEHandlerToControl(System.Windows.Forms.Control parentControl, IApplicationGE geApplication)
        {
            this._parentControl = parentControl;
            this._googleEarth = geApplication;

            //Get the Handler of the application's MainForm to SetGEHandler._GEMainHandler.
            this._GEMainHandler = (IntPtr)this._googleEarth.GetMainHwnd();

            //Set the Hight of GoogleEarth's MainForm to 0, and hide the Height of GoogleEarth's MainForm.
            GetGEControl.SetWindowPos(this._GEMainHandler, GetGEControl.HWND_BOTTOM, 0, 0, 0, 0, GetGEControl.SWP_NOSIZE + GetGEControl.SWP_HIDEWINDOW);

            // Get the Handler of the application's map control.
            this._GEHandler = (IntPtr)_googleEarth.GetRenderHwnd();

            //Get the Handler of GoogleEarth's parentForm from GoogleEarth's map control.
            this._GEParentHandler = GetGEControl.GetParent(this._GEHandler);

            //将GE地图控件的父窗体设置为不可见
            //Hide the parentForm of GoogleEarth.
            GetGEControl.PostMessage((int)this._GEParentHandler, GetGEControl.WM_HIDE, 0, 0);

            //Set the Handler of GoogleEarth's parentForm to winform's control.
            GetGEControl.SetParent(this._GEHandler, parentControl.Handle);

            //
            ResizeGEControl();
        }
Beispiel #5
0
        void OnGUI()
        {
            if (Control == null) return;
            if (Control.Disposing || Control.IsDisposed || !Application.isPlaying)
            {
                _control = null;
                return;
            }

            _scrollPosition = UnityEngine.GUILayout.BeginScrollView(_scrollPosition);

            var control = Control.RaiseOnPaintEditor(position.width);

            UnityEngine.GUILayout.Label("");
            if (UnityEngine.GUILayout.Button("Dispose", "Box"))
                Control.Dispose();
            if (UnityEngine.GUILayout.Button("Render", "Box"))
            {
                var renderWindow = (AppControlRender)AppControlRender.ShowWindow();
                renderWindow.Control = Control;
            }

            if (control != null && control is System.Windows.Forms.Control) Control = control as System.Windows.Forms.Control;
            UnityEngine.GUILayout.EndScrollView();
        }
        public void SetContent(AbstractEditor editor)
        {
            if (editor != null && editor is IToolboxProvider)
            {
                System.Windows.Forms.Control con = (editor as IToolboxProvider).ToolboxControl;
                if (con != control)
                {
                    if (control != null)
                        this.Controls.Remove(control);

                    control = con;
                    control.Dock = System.Windows.Forms.DockStyle.Fill;
                    this.Controls.Add(control);
                    this.SetFont(control);
                }
                if (control != null)
                {
                    control.Tag = editor;
                }
            }
            else if (control != null)
            {
                this.Controls.Remove(control);
                control = null;
            }
        }
 public SettingsMenagerStructure(System.Windows.Forms.Control control, string defaultText)
 {
     this.type = control.GetType();
     this.name = control.Name;
     this.text = control.Text;
     this.defaultText = defaultText;
     this.control = control;
 }
Beispiel #8
0
 public PropertyFeel(PropertyGrid grid)
 {
     if (grid != null)
     {
         mPropCtrl = grid;
         mParentWnd = mPropCtrl.Grid;
     }
 }
		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.WindowsControlMenuButton"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="iconFilePath"></param>
		/// <param name="control"></param>
		public WindowsControlMenuButton(
			string name,
			string iconFilePath,
			System.Windows.Forms.Control control) : base(iconFilePath)
		{
			this.Description = name;
			this._control = control;
		}
Beispiel #10
0
		public void ResetCursor()
		{
			if (mControl != null && mControl.Cursor == mCursor)
			{
				mControl.Cursor = mOldCursor;
				mControl = null;
			}
		}
 public SilkroadMapEditor(System.Windows.Forms.Control renderControl)
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     m_drawSurfaceControl = renderControl;
     graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
     System.Windows.Forms.Control.FromHandle((this.Window.Handle)).VisibleChanged += new EventHandler(Game1_VisibleChanged);
 }
Beispiel #12
0
 void Awake()
 {
     if (_control != null)
     {
         _control.Dispose();
         _control = null;
     }
 }
Beispiel #13
0
		public void ApplyCursor(System.Windows.Forms.Control control)
		{
			if (mControl == null)
			{
				mControl = control;
				mOldCursor = mControl.Cursor;
				mControl.Cursor = mCursor;
			}
		}
Beispiel #14
0
		public Scene(System.Windows.Forms.Control container, UICore.Connection connection)
		{
			Container = container;
			Width = Container.ClientSize.Width;
			Height = Container.ClientSize.Height;
			InitD3D();

			m_currentView = new ThreadView(connection, this);
			m_currentView.UpdateData();
		}
        public RibbonSensor(System.Windows.Forms.Control control, Ribbon ribbon, RibbonTab tabToSense)
        {
            _ribbon = ribbon;
            _control = control;
            _tab = tabToSense;

            _control.MouseMove += new System.Windows.Forms.MouseEventHandler(_control_MouseMove);
            _control.MouseDown += new System.Windows.Forms.MouseEventHandler(_control_MouseDown);
            _control.MouseUp += new System.Windows.Forms.MouseEventHandler(_control_MouseUp);
            _control.MouseLeave += new EventHandler(_control_MouseLeave);
        }
        public RibbonSensor(System.Windows.Forms.Control control, Ribbon ribbon, IEnumerable<RibbonItem> itemsToSense)
        {
            _ribbon = ribbon;
            _control = control;
            _itemsToSense = itemsToSense;
            SenseOnlyItems = true;

            _control.MouseMove += new System.Windows.Forms.MouseEventHandler(_control_MouseMove);
            _control.MouseDown += new System.Windows.Forms.MouseEventHandler(_control_MouseDown);
            _control.MouseUp += new System.Windows.Forms.MouseEventHandler(_control_MouseUp);
            _control.MouseLeave += new EventHandler(_control_MouseLeave);
        }
        public Game1(IntPtr drawSurface, System.Windows.Forms.Form parentForm, System.Windows.Forms.PictureBox pictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            this.parentForm = parentForm;
            this.pictureBox = pictureBox;

            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            gameForm = System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
        }
        public RenderSurface()
        {
            InitializeComponent();

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
                m_renderControl = new System.Windows.Forms.Control();
                m_renderControl.Dock = System.Windows.Forms.DockStyle.Fill;
                m_controlHost.Child = m_renderControl;

                m_gameThread = new Thread(GameThreadMain);
                m_gameThread.SetApartmentState(ApartmentState.STA);
                m_gameThread.Start();
            }
        }
        void OnGUI()
        {
            if (Control == null) return;
            if (Control.Disposing || Control.IsDisposed)
            {
                _control = null;
                return;
            }

            System.Drawing.Graphics g = new System.Drawing.Graphics();
            g.Control = Control;
            Control.RaiseOnPaint(new System.Windows.Forms.PaintEventArgs() { Graphics = g });

            GUI.skin.label.font = null;
            GUI.skin.label.fontSize = 13;
        }
Beispiel #20
0
        /// <summary>
        /// Creates a new instance of ObjectManager.
        /// </summary>
        /// <param name="socket">The socket used to communicate with Flash.</param>
        public ObjectManager(FlashSocket socket, System.Windows.Forms.Control controlForThread)
        {
            m_requests = new Hashtable();
            m_flatcache = new FlashObjectCollection();

            m_rootnode = new FlashObject("_root", FlashObject.ObjectType.MovieClip);
            m_globalnode = new FlashObject("_global", FlashObject.ObjectType.Object);

            m_flatcache.Add(m_rootnode);
            m_flatcache.Add(m_globalnode);

            m_threadcontrol = controlForThread;

            m_socket = socket;
            m_socket.DataRecieved += new FlashSocket.DataRecievedHandler(socket_DataRecieved);
        }
Beispiel #21
0
        public EditorGame(IntPtr drawSurface, System.Windows.Forms.Form parentForm, System.Windows.Forms.PictureBox surfacePictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            this.parentForm = parentForm;
            this.pictureBox = surfacePictureBox;

            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            Mouse.WindowHandle = drawSurface;

            gameForm = System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
            parentForm.SizeChanged += new EventHandler(pictureBox_SizeChanged);

            parentForm.Activated += new EventHandler(parentForm_ChangeActiveState);
            parentForm.Deactivate += new EventHandler(parentForm_ChangeActiveState);
        }
        //public Hashtable EventList
        //{
        //    get { return this.events; }
        //}

        #endregion

        #region · Constructors ·

        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            this.events = new Hashtable();
            this.events = Hashtable.Synchronized(this.events);
            this.handle = handle;
#if (NET_CF)
            this.syncControl = new System.Windows.Forms.Control();
            IntPtr h = this.syncControl.Handle; // force handle creation
#else
            this.syncContext = SynchronizationContext.Current ?? new SynchronizationContext();
#endif
                    

            // Initialize the connection
            if (this.database == null)
            {
                GdsConnection connection = new GdsConnection(ipAddress, portNumber);

                connection.Connect();

                this.database = new GdsDatabase(connection);
            }
        }
Beispiel #23
0
        public void MearseMouseDown(System.Drawing.Point mousePosition, System.Windows.Forms.Control mapControl)
        {
            if (this._graphics == null)
            {
                this._mapControl = mapControl;
                this._graphics = mapControl.CreateGraphics();
                this._measureLine = new GraphicsPath();
            }

            this._graphics.FillRectangle(new SolidBrush(Color.Blue), new Rectangle(mousePosition.X - 3, mousePosition.Y - 3, 6, 6));

            if (this._measureLine.PointCount == 0 && this._startDraw == false)
            {
                this._curPoint = this._prePoint = mousePosition;
                this._startDraw = true;
            }
            else
            {
                this._prePoint = this._curPoint;
                this._curPoint = mousePosition;
                this._measureLine.AddLine(this._prePoint, this._curPoint);
                this._graphics.DrawPath(new System.Drawing.Pen(Color.Blue, 4), this._measureLine);
            }
        }
 public PinkyGame()
 {
     form = System.Windows.Forms.Control.FromHandle(this.Window.Handle);
     form.VisibleChanged += gameForms_VisibleChanged;
 }
Beispiel #25
0
 public RootWidget(System.Windows.Forms.Control parentControl)
 {
     m_ParentControl = parentControl;
 }
Beispiel #26
0
        /// <summary>
        /// Checks whether a strings is null or <see cref="String.Empty" />.  Null values are accepted.
        /// </summary>
        /// <param name="AValue">The string to check.</param>
        /// <param name="ADescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="AValue" /> is not null and not <see cref="String.Empty" />,
        /// otherwise a <see cref="TVerificationResult" /> is returned that
        /// contains details about the problem, with a message that uses <paramref name="ADescription" />.</returns>
        public static TVerificationResult StringMustNotBeEmpty(string AValue, string ADescription,
                                                               object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;
            String Description = THelper.NiceValueDescription(ADescription);

            // Check
            if ((AValue == null) ||
                (AValue == String.Empty))
            {
                ReturnValue = new TVerificationResult(AResultContext,
                                                      ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOEMPTYSTRING, CommonResourcestrings.StrInvalidStringEntered + Environment.NewLine +
                                                                              StrStringMustNotBeEmpty, new string[] { Description }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return(ReturnValue);
        }
Beispiel #27
0
 public override bool CanParent(System.Windows.Forms.Control control)
 {
     return(control is MetroFramework.Controls.MetroLabel || control is MetroFramework.Controls.MetroProgressSpinner);
 }
Beispiel #28
0
 private void cmbPrimary_SelectedValueChanged(object sender, EventArgs e)
 {
     System.Windows.Forms.Control cmb = (System.Windows.Forms.Control)sender;
     Forms.Stats.frmChart         frm = (Forms.Stats.frmChart)cmb.Parent;
     updateFormValues(frm);
 }
Beispiel #29
0
 /// <summary>
 /// Checks whether an e-mail address is valid (logical only, no lookup is done).
 /// Does not allow more than one email address in the <paramref name="AEmailAddress" />
 /// Argument.
 /// </summary>
 /// <param name="AEmailAddress">E-mail address that should be verified.</param>
 /// <param name="AResultContext">Context of verification (can be null).</param>
 /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
 /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
 /// <returns>Null if <paramref name="AEmailAddress" /> contains a valid email address,
 /// otherwise a <see cref="TVerificationResult" /> is returned that contains details about
 /// the problem (also in the case where more than one e-mail Address is contained in
 /// <paramref name="AEmailAddress" /> - even if the e-mail Addresses are correct!).
 /// </returns>
 public static TVerificationResult ValidateEmail(String AEmailAddress,
                                                 object AResultContext, System.Data.DataColumn AResultColumn, System.Windows.Forms.Control AResultControl)
 {
     return(ValidateEmail(AEmailAddress, false, AResultContext, AResultColumn, AResultControl));
 }
Beispiel #30
0
        public AniWindow(IntPtr hwnd, int dwFlags, int CloseOrOpen, System.Windows.Forms.Control myform)
        {
            try
            {
                if (CloseOrOpen == 1)
                {
                    foreach (System.Windows.Forms.Control mycontrol in myform.Controls)
                    {
                        string m = mycontrol.GetType().ToString();
                        m = m.Substring(m.Length - 5);
                        if (m == "Label")
                        {
                            mycontrol.Visible = false;     //这里是在动画效果之前,把表单上可视的LABEL设为不可视
                        }
                    }
                }

                //打开or关闭 0是关闭 1是打开
                if (CloseOrOpen == 0)
                {
                    CloseOpen = 0x10000;
                }

                if (dwFlags == 100)
                {
                    int    zz = 10;
                    Random a  = new Random();
                    dwFlags = (int)a.Next(zz);
                }

                switch (dwFlags)
                {
                case 0:    //普通显示
                    AnimateWindow(hwnd, 200, AW_ACTIVATE);
                    break;

                case 1:    //从左向右显示
                    AnimateWindow(hwnd, 200, AW_HOR_POSITIVE | CloseOpen);
                    break;

                case 2:    //从右向左显示
                    AnimateWindow(hwnd, 200, AW_HOR_NEGATIVE | CloseOpen);
                    break;

                case 3:    //从上到下显示
                    AnimateWindow(hwnd, 200, AW_VER_POSITIVE | CloseOpen);
                    break;

                case 4:    //从下到上显示
                    AnimateWindow(hwnd, 200, AW_VER_NEGATIVE | CloseOpen);
                    break;

                case 5:    //透明渐变显示
                    AnimateWindow(hwnd, 500, AW_BLEND | CloseOpen);
                    break;

                case 6:    //从中间向四周
                    AnimateWindow(hwnd, 500, AW_CENTER | CloseOpen);
                    break;

                case 7:    //左上角伸展
                    AnimateWindow(hwnd, 200, AW_SLIDE | AW_HOR_POSITIVE | AW_VER_POSITIVE | CloseOpen);
                    break;

                case 8:    //左下角伸展
                    AnimateWindow(hwnd, 200, AW_SLIDE | AW_HOR_POSITIVE | AW_VER_NEGATIVE | CloseOpen);
                    break;

                case 9:    //右上角伸展
                    AnimateWindow(hwnd, 200, AW_SLIDE | AW_HOR_NEGATIVE | AW_VER_POSITIVE | CloseOpen);
                    break;

                case 10:    //右下角伸展
                    AnimateWindow(hwnd, 1000, AW_SLIDE | AW_HOR_NEGATIVE | AW_VER_NEGATIVE | CloseOpen);
                    break;
                }

                if (CloseOrOpen == 1)
                {
                    foreach (System.Windows.Forms.Control mycontrol in myform.Controls)
                    {
                        string m = mycontrol.GetType().ToString();
                        m = m.Substring(m.Length - 5);
                        if (m == "Label")
                        {
                            mycontrol.Visible = true; //这里恢复LABEL的可视.
                        }
                    }
                }
            }
            catch { }
        }
Beispiel #31
0
 public static GPURenderer Create(System.Windows.Forms.Control cltr)
 {
     return(Create(cltr, Configuration.Renderer));
 }
Beispiel #32
0
        /// <summary>
        /// Initializes a GpsHandler for communication with GPS receiver.
        /// The GpsHandler is used for communication with the GPS device and process information from the GPS revice.
        /// </summary>
        /// <param name="Parent">Parent form which callbacks should be directed to.</param>
        /// <example>
        /// The following example demonstrates how to create an GpsHandler instance that reacts to GPS position events.
        /// <code>
        /// [C#]
        /// public class Form1 : System.Windows.Forms.Form
        /// {
        /// 	public static GPSHandler GPS;
        /// 	public Form1()
        /// 	{
        /// 	InitializeComponent();
        /// 	//Initialize GPS handler
        /// 	GPS = new GPSHandler(this); 
        /// 	//Hook up GPS data events to a handler
        /// 	GPS.NewGPSFix += new GPSHandler.NewGPSFixHandler(this.GPSEventHandler);
        /// }
        /// 
        /// public void ExitApp()
        /// {
        /// 	GPS.Dispose();  //Closes serial port and cleans up
        /// 	Application.Exit();
        /// }
        /// 
        /// private void GPSEventHandler(object sender, GPSHandler.GPSEventArgs e)
        /// {
        /// 	switch (e.TypeOfEvent)
        /// 	{
        /// 		case GPSEventType.GPRMC:  //Recommended minimum specific GPS/Transit data
        /// 			if(GPS.HasGPSFix) //Is a GPS fix available?
        /// 			{
        /// 				lbPosition.Text = GPS.RMC.Longitude.ToString() + "," + GPS.RMC.Latitude.ToString();
        /// 				lbHeading.Text = GPS.RMC.Course.ToString();
        /// 				lbSpeed.Text = GPS.RMC.Speed.ToString() + " mph";
        /// 				lbTimeOfFix.Text = GPS.RMC.TimeOfFix + " - " + GPS.RMC.DateOfFix;
        /// 			}
        /// 			else
        /// 			{
        /// 				lbPosition.Text = "No fix";
        /// 				lbHeading.Text = "N/A";
        /// 				lbSpeed.Text = "N/A";
        /// 				lbTimeOfFix.Text = "N/A";
        /// 			}
        /// 			break;
        /// 	}
        /// }
        /// 
        /// private void btnStartGPS_Click(object sender, System.EventArgs e)
        /// {
        /// 	if(!GPS.IsPortOpen) 
        /// 	{
        /// 		try
        /// 		{
        /// 			//Open serial port 1 at 4800baud               
        /// 			GPS.Start("COM1",4800);
        /// 		}
        /// 		catch(System.Exception ex) 
        /// 		{
        /// 			MessageBox.Show("An error occured when trying to open port: " + ex.Message);
        /// 		}
        /// 	}
        /// }
        /// </code>
        /// </example>
        public GPSHandler(System.Windows.Forms.Control Parent)
        {
            _Parent = Parent;
            disposed = false;
            this._NewGPSFix += new NewGPSFixHandler(this.GPSEventHandler);

            //Link event from GPS receiver to process data function
            GpsPort.NewGPSData += new SharpGps.SerialPort.NewGPSDataHandler(this.GPSDataEventHandler);
            this.GPRMC = new SharpGps.NMEA.GPRMC();
            this.GPGGA = new SharpGps.NMEA.GPGGA();
            this.GPGSA = new SharpGps.NMEA.GPGSA();
            this.GPRMC = new SharpGps.NMEA.GPRMC();
            this.PGRME = new SharpGps.NMEA.GPRME();
            this.GPGSV = new SharpGps.NMEA.GPGSV();
        }
Beispiel #33
0
 public bool ActivateControl(System.Windows.Forms.Control active)
 {
     if (this.Controls.Contains(active))
     {
         // Select the control and scroll the control into view if needed.
         active.Select();
         this.ScrollControlIntoView(active);
         this._activeControl = active;
         return true;
     }
     return false;
 }
 public bool SelectNextControl(System.Windows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap)
 {
 }
 public void PerformLayout(System.Windows.Forms.Control affectedControl, string affectedProperty)
 {
 }
Beispiel #36
0
        public static int Position(
            System.Drawing.Graphics graphics,
            System.Windows.Forms.Control ctl,
            int iTop)
        {
            const char c = 'K';

            System.Drawing.SizeF sizef;
            System.Drawing.SizeF sizefText;
            System.Drawing.SizeF sizefSpace;
            System.Drawing.SizeF sizeFNew;
            int  chars     = 0;
            int  cnt       = 0;
            bool noResize  = false;
            bool multiline = false;
            int  iLines    = 0;
            int  iChars    = 0;

            ctl.Top = iTop;

            if (ctl is System.Windows.Forms.DataGrid)
            {
                noResize = true;
            }
            else if (ctl is System.Windows.Forms.TextBox)
            {
                chars     = ((System.Windows.Forms.TextBox)ctl).MaxLength;
                multiline = ((System.Windows.Forms.TextBox)ctl).Multiline;
            }
            else if (ctl is System.Windows.Forms.ComboBox)
            {
                chars = ((System.Windows.Forms.ComboBox)ctl).MaxLength;
            }

            if (chars == 0)
            {
                cnt = 1;
            }
            else
            {
                cnt = chars;
            }

            if (!noResize)
            {
                sizefText  = graphics.MeasureString(ctl.Text, ctl.Font);
                sizef      = graphics.MeasureString(new string(c, cnt), ctl.Font);
                sizefSpace = new System.Drawing.SizeF(ctl.Parent.Size.Width - ctl.Left - border,
                                                      ctl.Parent.Size.Height - ctl.Top - border);

                if (sizefText.Width > sizef.Width)
                {
                    sizef.Width = sizefText.Width;
                }

                if (chars > 32000)
                {
                    sizeFNew = new System.Drawing.SizeF(ctl.Parent.Width - ctl.Left, sizef.Height + 6);
                }
                else
                {
                    sizeFNew = sizef;
                }

                if (multiline)
                {
                    sizeFNew = new System.Drawing.SizeF(sizeFNew.Width, sizefSpace.Height);
                }

                ctl.Size = new System.Drawing.Size(System.Convert.ToInt32(sizeFNew.Width), System.Convert.ToInt32(sizeFNew.Height));
            }
            iTop = ctl.Bottom + margin;
            return(iTop);
        }
Beispiel #37
0
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //	Input_Manager();
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //	public void Dispose();

        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        public void initialise(System.Windows.Forms.Control control)
        {
            control.MouseMove += new System.Windows.Forms.MouseEventHandler(this.InputManager_MouseMove);
            control.MouseDown += new System.Windows.Forms.MouseEventHandler(this.InputManager_MouseDown);
            control.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.InputManager_MouseUp);
        }
Beispiel #38
0
 /// <summary>
 /// Get handle of this window.
 /// </summary>
 public static IntPtr Handle(this System.Windows.Forms.Control window)
 {
     return(window.IsDisposed ? default : Handle((System.Windows.Forms.IWin32Window)window));
 }
Beispiel #39
0
 public static System.IObservable <TSource> SubscribeOn <TSource>(this System.IObservable <TSource> source, System.Windows.Forms.Control control)
 {
     throw null;
 }
Beispiel #40
0
        /// <summary>
        /// Checks whether a strings' length is lesser or equal to the specified amount of characters.  Null values are accepted.
        /// </summary>
        /// <param name="AValue">The string to check.</param>
        /// <param name="APermittedStringLength">The permitted amount of characters.</param>
        /// <param name="ADescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="AValue" /> is not null and not <see cref="String.Empty" />,
        /// otherwise a <see cref="TVerificationResult" /> is returned that
        /// contains details about the problem, with a message that uses <paramref name="ADescription" />.</returns>
        public static TVerificationResult StringLengthLesserOrEqual(string AValue, int APermittedStringLength, string ADescription,
                                                                    object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;
            String Description = THelper.NiceValueDescription(ADescription);

            // Check
            if ((AValue != null) &&
                (AValue.Length > APermittedStringLength))
            {
                ReturnValue = new TVerificationResult(AResultContext,
                                                      ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_STRINGTOOLONG, CommonResourcestrings.StrInvalidStringEntered + Environment.NewLine +
                                                                              StrStringTooLong, new string[] { Description, APermittedStringLength.ToString(), AValue.Length.ToString() }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return(ReturnValue);
        }
Beispiel #41
0
 public Document(System.Windows.Forms.Control ctrl)
 {
     this.Drawer = ctrl.CreateGraphics();
 }
Beispiel #42
0
 void tb_RegionChanged(object sender, EventArgs e)
 {
     System.Windows.Forms.Control cmb = (System.Windows.Forms.Control)sender;
     Forms.Stats.frmChart         frm = (Forms.Stats.frmChart)cmb.Parent;
     updateFormValues(frm);
 }
 protected override System.Drawing.Point ScrollToControl(System.Windows.Forms.Control activeControl)
 {
     // Returning the current location prevents the panel from
     // scrolling to the active control when the panel loses and regains focus
     return(this.DisplayRectangle.Location);
 }
 public DrawLamp(System.Windows.Forms.Control control)
 {
     this.control = control;
 }
Beispiel #45
0
        /// <summary>
        /// Checks whether two strings are in correct order (lexical comparison).  Null values are accepted.
        /// </summary>
        /// <param name="ATxt1">The first string; it is supposed to be lesser or equal than ATxt2.</param>
        /// <param name="ATxt2">The second string; it is supposed to be greater or equal than ATxt1.</param>
        /// <param name="AFirstDescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="ASecondDescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="ATxt1" /> is lesser or equal than
        /// <paramref name="ATxt2" />, otherwise a <see cref="TVerificationResult" /> is returned that
        /// contains details about the problem, with a message that uses <paramref name="AFirstDescription" />
        /// and <paramref name="ASecondDescription" />.</returns>
        public static TVerificationResult FirstLesserOrEqualThanSecondString(String ATxt1, String ATxt2,
                                                                             String AFirstDescription, String ASecondDescription,
                                                                             object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue;

            string FirstDescription  = THelper.NiceValueDescription(AFirstDescription);
            string SecondDescription = THelper.NiceValueDescription(ASecondDescription);

            // Check
            if (System.String.Compare(ATxt1, ATxt2, false) <= 0)
            {
                // Lexical comparision results in: ATxt1 <= ATxt2
                ReturnValue = null;
            }
            else
            {
                ReturnValue = new TVerificationResult(AResultContext,
                                                      ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_INCONGRUOUSSTRINGS,
                                                                              StrInvalidStringOrder, new string[] { FirstDescription, SecondDescription }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return(ReturnValue);
        }
 public virtual bool CanParent(System.Windows.Forms.Control control)
 {
 }
Beispiel #47
0
        /// <summary>
        /// Checks whether an e-mail address is valid (logical only, no lookup is done). Multiple email addresses
        /// may be contained in Argument <paramref name="AEmailAddress" /> if Argument
        /// <paramref name="AAllowMoreThanOneEMailAddress" /> is set to true.
        /// </summary>
        /// <param name="AEmailAddress">E-mail address that should be verified.</param>
        /// <param name="AAllowMoreThanOneEMailAddress">Set this to true if more than one e-mail
        /// Address can be contained in AEmailAddress. If this is set to true, all
        /// contained e-mail Addresses will be validated. Recognized separators are
        /// comma and semicolon (',' and ';').</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="AEmailAddress" /> contains a valid email address,
        /// otherwise a <see cref="TVerificationResult" /> is returned that contains details about
        /// the problem (also in the case where <paramref name="AAllowMoreThanOneEMailAddress" />
        /// is set to false and more than one e-mail Address is contained in
        /// <paramref name="AEmailAddress" /> - even if the e-mail Addresses are correct!).
        /// </returns>
        public static TVerificationResult ValidateEmail(String AEmailAddress, Boolean AAllowMoreThanOneEMailAddress,
                                                        object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;

            System.Text.RegularExpressions.Regex RegEx;
            String SeparatorWarning = String.Empty;

            String[] EmailAddresses;
            String   EmailAddressPart;
            String   EmailAddressPartInfo = String.Empty;

            /*
             * RegEx taken from http://www.regexlib.com/REDetails.aspx?regexp_id=711
             * This accepts RFC 2822 email addresses in the form: [email protected] OR
             * Blah <*****@*****.**> RFC 2822 email 'mailbox': mailbox = name-addr | addr-spec name-addr = [display-name] "<" addr-spec ">" addr-spec = local-part "@" domain domain = rfc2821domain | rfc2821domain-literal local-part conforms to RFC
             * 2822. domain is either: An rfc 2821 domain (EXCEPT that the final sub-domain must consist of 2 or more letters only). OR An rfc 2821 address-literal. (Note, no attempt is made to fully validate an IPv6 address-literal.) Notes: This
             * pattern uses (.NET/Perl only?) features lookahead "(?<name>)" and alternation/IF (?(name)). RFC 2822 (and 822) do allow embedded comments, whitespace, and newlines within *some* parts of an email address, but this pattern above DOES
             * NOT. RFC 2822 (and 822) allow the domain to be a simple domain with NO ".", but this pattern requires a compound domain at least one "." in the domain name, as per RFC 2821 (4.1.2). RFC 2822 allows/disallows certain whitespace
             * characters in parts of an email address, such as TAB, CR, LF BUT the pattern above does NOT test for these, and assumes that they are not present in the string (on the basis that these characters are hard to enter into an edit box).
             */
            RegEx = new System.Text.RegularExpressions.Regex(
                @"^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*""\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*"")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$");

            // alternative RegEx for emailchecks:
            // MSDN Example: '^([\w\.]+)@((\[[09]1,3\.[09]1,3\.[09]1,3\.)|(([\w]+\.)+))([azAZ]2,4|[09]1,3)(\]?)$'
            // simple email check: '^\S+@\S+\.\S+$'

            // Check
            if (AEmailAddress != String.Empty)
            {
                EmailAddresses = StringHelper.SplitEmailAddresses(AEmailAddress);

                if (EmailAddresses.Length > 1)
                {
                    if (!AAllowMoreThanOneEMailAddress)
                    {
                        SeparatorWarning = Environment.NewLine +
                                           StrEmailAddrContainsEmailSeparatorNotAllowed;

                        ReturnValue = new TVerificationResult(AResultContext,
                                                              ErrorCodes.GetErrorInfo(ERR_EMAILADDRESSINVALID, StrEmailAddNotValid + SeparatorWarning,
                                                                                      new string[] { AEmailAddress }));
                    }
                    else
                    {
                        for (int Counter = 0; Counter <= EmailAddresses.Length - 1; Counter += 1)
                        {
                            if (!RegEx.IsMatch(EmailAddresses[Counter].Trim()))
                            {
                                if ((AEmailAddress.IndexOf(',') != -1) ||
                                    (AEmailAddress.IndexOf(';') != -1))
                                {
                                    SeparatorWarning = Environment.NewLine +
                                                       StrEmailAddrContainsEmailSeparator;
                                }

                                EmailAddressPart = EmailAddresses[Counter].Trim();

                                if (EmailAddressPart != String.Empty)
                                {
                                    EmailAddressPartInfo = EmailAddresses[Counter].Trim();
                                }

                                if (EmailAddressPartInfo != String.Empty)
                                {
                                    ReturnValue = new TVerificationResult(AResultContext,
                                                                          ErrorCodes.GetErrorInfo(ERR_EMAILADDRESSINVALID, StrEmailAddOrPartNotValid +
                                                                                                  SeparatorWarning, new string[] { AEmailAddress, EmailAddressPartInfo }));
                                }
                                else
                                {
                                    ReturnValue = new TVerificationResult(AResultContext,
                                                                          ErrorCodes.GetErrorInfo(ERR_EMAILADDRESSINVALID, StrEmailAddNotValid +
                                                                                                  SeparatorWarning, new string[] { AEmailAddress }));
                                }

                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (RegEx.IsMatch(AEmailAddress))
                    {
                        ReturnValue = null;
                    }
                    else
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                                                              ErrorCodes.GetErrorInfo(ERR_EMAILADDRESSINVALID, StrEmailAddNotValid, new string[] { AEmailAddress }));
                    }
                }
            }

            if ((AResultColumn != null) &&
                (ReturnValue != null))
            {
                ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
            }

            return(ReturnValue);
        }
Beispiel #48
0
 public static WpfTextEditor add_WpfTextEditor(this System.Windows.Forms.Control control)
 {
     return(control.add_WPF_Control <WpfTextEditor>());
 }
Beispiel #49
0
    private void DoControlText(System.Windows.Forms.Control c, string formName)
    {
        bool doText = false;
        //Some controls we do not look up: notably TextBox
        if ((c) is System.Windows.Forms.TextBox)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.RichTextBox)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.ComboBox)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.ListBox)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.MenuStrip)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.WebBrowser)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.ToolStrip)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.Panel)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.PictureBox)
        {
            doText = false;
        }
        else if ((c) is System.Windows.Forms.StatusBar)
        {
            doText = false;
        }
        else if ((c.Text == null))
        {
            doText = false;
        }
        else
        {
            doText = true;
        }
        if (doText)
        {
            bool useTag = false;
            if (c.Tag == null)
            {
                useTag = false;
            }
            else if (string.IsNullOrEmpty(c.Tag.ToString()))
            {
                useTag = false;
            }
            else
            {
                useTag = true;
            }
            string key = null;
            if (useTag)
            {
                key = c.Tag.ToString();
            }
            else
            {
                key = formName + "." + c.Name;
            }

            string textKey = key + ".Text";
            string text = GetText(textKey);
            if (text != textKey)
            {
                //Found an entry.
                c.Text = text;
            }
            else
            {
                //Failed to find anything when using the tag or the full formName.controlName
                //Try falling back now to our Common file, which should save me having to 
                //duplicate lots and lots of entries.
                textKey = c.Name + ".Text";
                text = GetText(textKey);
                if (text != textKey)
                {
                    c.Text = text;
                }
            }
        }
    }
Beispiel #50
0
 /// <summary>
 /// 初始化对象并设置绑定的控件
 /// </summary>
 /// <param name="ctl">绑定的控件</param>
 public MouseCapturer(System.Windows.Forms.Control ctl)
 {
     myBindControl = ctl;
 }
Beispiel #51
0
        // workaround to prevent flickering with ListView controls
        public static void DoubleBuffered(this System.Windows.Forms.Control control, bool enable)
        {
            var doubleBufferPropertyInfo = control.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);

            doubleBufferPropertyInfo.SetValue(control, enable, null);
        }
Beispiel #52
0
 public UpdateCheckNotificationTarget(System.Windows.Forms.Control target, UpdateCheckedDelegate updatedChecked)
 {
     m_UpdateChecked = updatedChecked;
     m_Target        = target;
 }
        void IDeviceSpecificDesigner.InitHeader(int mergingContext)
        {
            HeaderPanel panel = new HeaderPanel();
            HeaderLabel lblDescription = new HeaderLabel();

            lblDescription.TabIndex = 0;
            lblDescription.Text = SR.GetString(
                SR.MobileControl_SettingGenericChoiceDescription
            );
            panel.Height = lblDescription.Height;
            panel.Width = lblDescription.Width;
            panel.Controls.Add(lblDescription);
            _header = panel;
        }
Beispiel #54
0
 public ControlScheduler(System.Windows.Forms.Control control)
 {
 }
 public bool Contains(System.Windows.Forms.Control ctl)
 {
 }
Beispiel #56
0
        private string GetData(System.Windows.Forms.Control ui)
        {
            StringBuilder res = new StringBuilder();

            if (PythonToolsPackage.IsIpyToolsInstalled())
            {
                res.AppendLine("WARNING: IpyTools is installed on this machine.  Having both IpyTools and Python Tools for Visual Studio installed will break Python editing.");
            }

            string pythonPathIsMasked = "";

            EnvDTE.DTE dte = null;
            IPythonInterpreterFactoryProvider[] knownProviders  = null;
            IPythonLauncherProvider[]           launchProviders = null;
            InMemoryLogger inMemLogger = null;

            ui.Invoke((Action)(() => {
                pythonPathIsMasked = _serviceProvider.GetPythonToolsService().GeneralOptions.ClearGlobalPythonPath
                    ? " (masked)"
                    : "";
                dte = (EnvDTE.DTE)_serviceProvider.GetService(typeof(EnvDTE.DTE));
                var model = _serviceProvider.GetComponentModel();
                knownProviders = model.GetExtensions <IPythonInterpreterFactoryProvider>().ToArray();
                launchProviders = model.GetExtensions <IPythonLauncherProvider>().ToArray();
                inMemLogger = model.GetService <InMemoryLogger>();
            }));

            res.AppendLine("Projects: ");

            var projects = dte.Solution.Projects;

            foreach (EnvDTE.Project project in projects)
            {
                string name;
                try {
                    // Some projects will throw rather than give us a unique
                    // name. They are not ours, so we will ignore them.
                    name = project.UniqueName;
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    bool isPythonProject = false;

                    try {
                        isPythonProject = Utilities.GuidEquals(PythonConstants.ProjectFactoryGuid, project.Kind);
                    } catch (Exception ex2) when(!ex2.IsCriticalException())
                    {
                    }

                    if (isPythonProject)
                    {
                        // Actually, it was one of our projects, so we do care
                        // about the exception. We'll add it to the output,
                        // rather than crashing.
                        res.AppendLine("    Project: " + ex.Message);
                        res.AppendLine("        Kind: Python");
                    }
                    continue;
                }
                res.AppendLine("    Project: " + name);

                if (Utilities.GuidEquals(PythonConstants.ProjectFactoryGuid, project.Kind))
                {
                    res.AppendLine("        Kind: Python");

                    foreach (var prop in InterestingDteProperties)
                    {
                        res.AppendLine("        " + prop + ": " + GetProjectProperty(project, prop));
                    }

                    var pyProj = project.GetPythonProject();
                    if (pyProj != null)
                    {
                        ui.Invoke((Action)(() => {
                            foreach (var prop in InterestingProjectProperties)
                            {
                                var propValue = pyProj.GetProjectProperty(prop);
                                if (propValue != null)
                                {
                                    res.AppendLine("        " + prop + ": " + propValue);
                                }
                            }
                        }));

                        foreach (var factory in pyProj.InterpreterFactories)
                        {
                            res.AppendLine();
                            res.AppendLine("        Interpreter: " + factory.Configuration.FullDescription);
                            res.AppendLine("            Id: " + factory.Configuration.Id);
                            res.AppendLine("            Version: " + factory.Configuration.Version);
                            res.AppendLine("            Arch: " + factory.Configuration.Architecture);
                            res.AppendLine("            Prefix Path: " + factory.Configuration.PrefixPath ?? "(null)");
                            res.AppendLine("            Path: " + factory.Configuration.InterpreterPath ?? "(null)");
                            res.AppendLine("            Windows Path: " + factory.Configuration.WindowsInterpreterPath ?? "(null)");
                            res.AppendLine("            Lib Path: " + factory.Configuration.LibraryPath ?? "(null)");
                            res.AppendLine(string.Format("            Path Env: {0}={1}{2}",
                                                         factory.Configuration.PathEnvironmentVariable ?? "(null)",
                                                         Environment.GetEnvironmentVariable(factory.Configuration.PathEnvironmentVariable ?? ""),
                                                         pythonPathIsMasked
                                                         ));
                        }
                    }
                }
                else
                {
                    res.AppendLine("        Kind: " + project.Kind);
                }

                res.AppendLine();
            }

            res.AppendLine("Environments: ");
            foreach (var provider in knownProviders.MaybeEnumerate())
            {
                res.AppendLine("    " + provider.GetType().FullName);
                foreach (var config in provider.GetInterpreterConfigurations())
                {
                    res.AppendLine("        Id: " + config.Id);
                    res.AppendLine("        Factory: " + config.FullDescription);
                    res.AppendLine("        Version: " + config.Version);
                    res.AppendLine("        Arch: " + config.Architecture);
                    res.AppendLine("        Prefix Path: " + config.PrefixPath ?? "(null)");
                    res.AppendLine("        Path: " + config.InterpreterPath ?? "(null)");
                    res.AppendLine("        Windows Path: " + config.WindowsInterpreterPath ?? "(null)");
                    res.AppendLine("        Lib Path: " + config.LibraryPath ?? "(null)");
                    res.AppendLine("        Path Env: " + config.PathEnvironmentVariable ?? "(null)");
                    res.AppendLine();
                }
            }

            res.AppendLine("Launchers:");
            foreach (var launcher in launchProviders.MaybeEnumerate())
            {
                res.AppendLine("    Launcher: " + launcher.GetType().FullName);
                res.AppendLine("        " + launcher.Description);
                res.AppendLine("        " + launcher.Name);
                res.AppendLine();
            }

            try {
                res.AppendLine("Logged events/stats:");
                res.AppendLine(inMemLogger.ToString());
                res.AppendLine();
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                res.AppendLine("  Failed to access event log.");
                res.AppendLine(ex.ToString());
                res.AppendLine();
            }

            try {
                res.AppendLine("System events:");

                var application = new EventLog("Application");
                var lastWeek    = DateTime.Now.Subtract(TimeSpan.FromDays(7));
                foreach (var entry in application.Entries.Cast <EventLogEntry>()
                         .Where(e => e.InstanceId == 1026L) // .NET Runtime
                         .Where(e => e.TimeGenerated >= lastWeek)
                         .Where(e => InterestingApplicationLogEntries.IsMatch(e.Message))
                         .OrderByDescending(e => e.TimeGenerated)
                         )
                {
                    res.AppendLine(string.Format("Time: {0:s}", entry.TimeGenerated));
                    using (var reader = new StringReader(entry.Message.TrimEnd())) {
                        for (var line = reader.ReadLine(); line != null; line = reader.ReadLine())
                        {
                            res.AppendLine(line);
                        }
                    }
                    res.AppendLine();
                }
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                res.AppendLine("  Failed to access event log.");
                res.AppendLine(ex.ToString());
                res.AppendLine();
            }

            res.AppendLine("Loaded assemblies:");
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().OrderBy(assem => assem.FullName))
            {
                AssemblyFileVersionAttribute assemFileVersion;
                var error = "(null)";
                try {
                    assemFileVersion = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false)
                                       .OfType <AssemblyFileVersionAttribute>()
                                       .FirstOrDefault();
                } catch (Exception e) when(!e.IsCriticalException())
                {
                    assemFileVersion = null;
                    error            = string.Format("{0}: {1}", e.GetType().Name, e.Message);
                }

                res.AppendLine(string.Format("  {0}, FileVersion={1}",
                                             assembly.FullName,
                                             assemFileVersion?.Version ?? error
                                             ));
            }
            res.AppendLine();

            string globalAnalysisLog = PythonTypeDatabase.GlobalLogFilename;

            if (File.Exists(globalAnalysisLog))
            {
                res.AppendLine("Global Analysis:");
                try {
                    res.AppendLine(File.ReadAllText(globalAnalysisLog));
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    res.AppendLine("Error reading the global analysis log.");
                    res.AppendLine("Please wait for analysis to complete and try again.");
                    res.AppendLine(ex.ToString());
                }
            }
            res.AppendLine();

            res.AppendLine("Environment Analysis Logs: ");
            foreach (var provider in knownProviders)
            {
                foreach (var factory in provider.GetInterpreterFactories().OfType <IPythonInterpreterFactoryWithDatabase>())
                {
                    res.AppendLine(factory.Configuration.FullDescription);
                    string analysisLog = factory.GetAnalysisLogContent(CultureInfo.InvariantCulture);
                    if (!string.IsNullOrEmpty(analysisLog))
                    {
                        res.AppendLine(analysisLog);
                    }
                    res.AppendLine();
                }
            }
            return(res.ToString());
        }
Beispiel #57
0
 private System.Windows.Forms.Control CreateControl(String name, System.Windows.Forms.UserControl uc)
 {
     System.Windows.Forms.Control host = new System.Windows.Forms.Control();
     try
     {
         host = uc;
         host.Name = name;
     }
     catch (Autodesk.AutoCAD.Runtime.Exception ex)
     {
         AcadApp.AcaEd.WriteMessage("ERROR: GPPaletteSet.CreateControl()\n" + ex + "\n");
     }
     return host;
 }
 public System.Windows.Forms.Control GetNextControl(System.Windows.Forms.Control ctl, bool forward)
 {
 }
Beispiel #59
0
 public YBClient4(ConnectionSettings settings, System.Windows.Forms.Control container)
     : this(settings)
 {
     _synchContext = container;
 }
 public void ScrollControlIntoView(System.Windows.Forms.Control activeControl)
 {
 }