Example #1
0
 /// <summary>
 /// Jos content on control, kutsuu sen updatea. Basea ei tarvise kutsua jos ylikirjoitetaan.
 /// </summary>
 protected void UpdateContent(GameTime gameTime)
 {
     if (contentControl != null)
     {
         contentControl.Update(gameTime);
     }
 }
 /// <summary>
 /// Invalidates the transparent AdornerWindow by asking the Designer Frame beneath it to invalidate.  Note the they use of the .Update() call for perf. purposes.
 /// </summary>
 internal void InvalidateAdornerWindow()
 {
     if (DesignerFrameValid)
     {
         _designerFrame.Invalidate(true);
         _designerFrame.Update();
     }
 }
        public bool Login(LoginUser loginUser)
        {
            string userPrincipalName = DomainLdapTools.GetCurrentUserPrincipalName();

            if (string.IsNullOrEmpty(userPrincipalName))
            {
                throw new CustomException("获取本地域用户资料失败!");
            }

            _User.Text = userPrincipalName; //显示当前Domain帐号
            _User.Update();

            loginUser.Account = userPrincipalName;

            IBridge_User bridge = BridgeFactory.CreateUserBridge();

            //调用数据访问层的接口检查用户登录
            DataTable dt = bridge.Login(loginUser, Char.Parse(LoginUserType.W.ToString()));

            if (dt.Rows.Count == 0)
            {
                throw new CustomException("域用户'" + userPrincipalName + "'没有建立权限关联!");
            }
            DataRow row = dt.Rows[0];

            Loginer user = new Loginer();

            user.Account     = ConvertEx.ToString(row[tb_sys_User.FAccount]);
            user.AccountName = ConvertEx.ToString(row[tb_sys_User.FUserName]);
            user.FlagAdmin   = ConvertEx.ToString(row[tb_sys_User.FFlagAdmin]);
            user.Email       = ConvertEx.ToString(row[tb_sys_User.FMail]);
            user.Fid         = ConvertEx.ToString(row[tb_sys_User.FID]);
            user.LoginTime   = DateTime.Now;
            user.MachineName = GetComputerinfo.GetHostName();
            user.IPAddress   = GetComputerinfo.GetIP();
            user.CardNo      = ConvertEx.ToString(row[tb_sys_User.FCardNo]);

            user.DbType         = loginUser.DbType;
            user.DataSetName    = loginUser.DataSetDBName;
            Loginer.CurrentUser = user;//保存当前用户

            //登录日志
            IBridge_CommonService comBridge = BridgeFactory.CreateCommonServiceBridge();

            comBridge.WriteLogOP("0", "0", "登录系统", "");

            //下载用户权限
            SystemAuthentication.UserAuthorities = bridge.Getb_sys_UserAuthorities(user);

            return(true);
        }
        public bool Login(LoginUser loginUser)
        {
            string novellAccount = NovellLdapTools.NovellWhoAmI();

            //获取当前Novell用户及组. 通过groups获取用户权限数据
            //string[] groups = NovellLdapTools.NovellGetGroups(ref novellAccount);

            if (string.IsNullOrEmpty(novellAccount))
            {
                throw new CustomException("获取Novell本地用户登录资料失败!");
            }

            _User.Text = novellAccount; //显示当前Novell帐号
            _User.Update();

            loginUser.Account = novellAccount;

            IBridge_User bridge = BridgeFactory.CreateUserBridge();

            //调用数据访问层的接口检查用户登录
            DataTable dt = bridge.Login(loginUser, Char.Parse(LoginUserType.N.ToString()));

            if (dt.Rows.Count == 0)
            {
                throw new CustomException("Novell用户'" + novellAccount + "'没有建立权限关联!");
            }
            DataRow row = dt.Rows[0];

            Loginer user = new Loginer();

            user.Account     = ConvertEx.ToString(row[tb_sys_User.FAccount]);
            user.AccountName = ConvertEx.ToString(row[tb_sys_User.FUserName]);
            user.FlagAdmin   = ConvertEx.ToString(row[tb_sys_User.FFlagAdmin]);
            user.Email       = ConvertEx.ToString(row[tb_sys_User.FMail]);
            user.Fid         = ConvertEx.ToString(row[tb_sys_User.FID]);
            user.LoginTime   = DateTime.Now;
            user.MachineName = GetComputerinfo.GetHostName();
            user.IPAddress   = GetComputerinfo.GetIP();
            user.CardNo      = ConvertEx.ToString(row[tb_sys_User.FCardNo]);

            user.DbType         = loginUser.DbType;
            user.DataSetName    = loginUser.DataSetDBName;
            Loginer.CurrentUser = user;//保存当前用户
            IBridge_CommonService comBridge = BridgeFactory.CreateCommonServiceBridge();

            comBridge.WriteLogOP("0", "0", "登录系统", "");
            SystemAuthentication.UserAuthorities = bridge.Getb_sys_UserAuthorities(user);//下载用户权限

            return(true);
        }
Example #5
0
 public void Update(GameTime gameTime)
 {
     if (!BaseScreen.Hidden)
     {
         BaseScreen.Update(gameTime);
     }
 }
        public void Update(GameTime gameTime, ContentManager Content)
        {
            foreach (GameItem gi in gameItems)
            {
                gi.Update();
            }

            foreach (var atk in attacks)
            {
                atk.Update();
            }
            foreach (Bar b in bars)
            {
                b.Update();
            }
            fighter.Update(gameTime);
            enemy.Update(gameTime);
            control.Update(gameTime, Content);
            //test

            playerHealth = control.PlayerHealth.ToString();
            playerMana   = control.PlayerMana.ToString();
            playerAtk    = control.PlayerAtk.ToString();
            playerSpAtk  = control.PlayerSpAtk.ToString();
            enemyHealth  = control.EnemyHealth.ToString();
            enemyMana    = control.EnemyMana.ToString();
            enemyAtk     = control.EnemyAtk.ToString();
            enemySpAtk   = control.EnemySpAtk.ToString();

            //test
        }
Example #7
0
        public static bool RunSafeInDb(Control control, Action <Database> action)
        {
            if (control != null)
            {
                control.Cursor = Cursors.WaitCursor;
                control.Update();
            }
            bool ret = false;

            try
            {
                using (var db = NewDb())
                    action(db);
                ret = true;
            }
            catch (Exception ex)
            {
                if (control != null)
                {
                    control.Cursor = Cursors.Default;
                }
                ShowError(ex);
            }
            if (control != null)
            {
                control.Cursor = Cursors.Default;
            }
            return(ret);
        }
        /// <include file='doc\ScrollableControlDesigner.uex' path='docs/doc[@for="ScrollableControlDesigner.WndProc"]/*' />
        /// <devdoc>
        ///     We override our base class's WndProc to monitor certain messages.
        /// </devdoc>
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            switch (m.Msg)
            {
            case NativeMethods.WM_HSCROLL:
            case NativeMethods.WM_VSCROLL:

                // When we scroll, we reposition a control without causing a
                // property change event.  Therefore, we must tell the
                // selection UI service to sync itself.
                //
                if (selectionUISvc == null)
                {
                    selectionUISvc = (ISelectionUIService)GetService(typeof(ISelectionUIService));
                }

                if (selectionUISvc != null)
                {
                    selectionUISvc.SyncSelection();
                }

                // Now we must paint our adornments, since the scroll does not
                // trigger a paint event
                //
                Control.Invalidate();
                Control.Update();
                break;
            }
        }
Example #9
0
 /// <summary>
 /// refreshes GUI control immediately
 /// </summary>
 /// <param name="c"></param>
 public static void updateControl(Control c)
 {
     c.Invalidate();
     c.Update();
     c.Refresh();
     Application.DoEvents();
 }
Example #10
0
        private void DrawRectangle(Control parent)
        {
            Graphics g = parent.CreateGraphics();

            g.DrawRectangle(System.Drawing.Pens.Aqua, snapRectangle);
            parent.Update();
        }
 private void UpdateControl()
 {
     // Trigger Paint event of control
     try
     {
         if (Control.InvokeRequired)
         {
             Control.Invoke(new MethodInvoker(delegate
             {
                 Control.Invalidate(true);
                 Control.Update();
                 //PaintControl(Control, new PaintEventArgs(Control.CreateGraphics(), Control.DisplayRectangle));
             }));
         }
         else
         {
             Control.Invalidate(true);
             Control.Update();
         }
     }
     catch (InvalidOperationException ex)
     {
         // Force Paint event - it will resubmit if invoke is required
         WriteLog(string.Format("Update Control failed. Forcing Paint after error: {0}", ex.Message));
         PaintControl(Control, new PaintEventArgs(Control.CreateGraphics(), Control.DisplayRectangle));
     }
     catch (Exception ex)
     {
         // Something else cause a problem - cannot update this control
         WriteLog("UpdateControl: Failed to invoke Control Update.", ex);
     }
 }
Example #12
0
        /// <summary>
        /// Capture a specific control in the client area of a form.
        /// </summary>
        /// <param name="window">This is a control which should be captured.</param>
        /// <returns>The image which has been captured.</returns>
        public virtual Bitmap CaptureControl(Control window)
        {
            Rectangle rc = window.RectangleToScreen(window.DisplayRectangle);

            window.Update();
            return(capture(window, rc));
        }
Example #13
0
 void _RenderByD2D(D2DGraphics graph, Rectangle refreshArea)
 {
     try
     {
         graph.BeginDraw();
         reDrawTree.ReCreateReDrawTree(rootScLayer, refreshArea);
         reDrawTree.Draw(graph);
         graph.EndDraw();
     }
     catch (Exception ex)
     {
         CreateD2D();
         control.Refresh();
         control.Update();
     }
 }
Example #14
0
        public void Update(GameTime gameTime)
        {
            mouseState = Mouse.GetState();

            btnClose.Update(gameTime);
            btnMax.Update(gameTime);
            btnMin.Update(gameTime);
            app.Update(gameTime);

            if (TitleBarDrag == false)
            {
                dragHandle = new Point(mouseState.X - WindowPanel.Bounds.X, mouseState.Y - WindowPanel.Bounds.Y);
            }

            if (mouseState.LeftButton == ButtonState.Pressed && TitleBar.Bounds.Contains(mouseState.Position) && !btnClose.Bounds.Contains(mouseState.Position) && !btnMax.Bounds.Contains(mouseState.Position) && !btnMin.Bounds.Contains(mouseState.Position))
            {
                TitleBarLMBDown(this, EventArgs.Empty);
            }
            else if (TitleBarDrag)
            {
                TitleBarLMBDown(this, EventArgs.Empty);
            }

            if (Mouse.GetState().LeftButton == ButtonState.Released)
            {
                TitleBarLMBRelease(this, EventArgs.Empty);
            }
        }
    private void Update()
    {
        if (_waitingAiToRespond)
        {
            return;
        }

        if (_waitingToRestart)
        {
            if (control.ConfirmRestart())
            {
                ResetGame();
            }

            return;
        }

        Vector2Int pos = control.Update();

        if (pos == new Vector2Int(-1, -1) || model.board[pos.x, pos.y] != Model.Mark.Empty)
        {
            return;
        }

        PlayAMove(pos);

        if (!model.endGame && vsAi)
        {
            _waitingAiToRespond = true;
            Invoke(nameof(AiPlay), 1);
        }
    }
        /// <summary>
        ///  We override our base class's WndProc to monitor certain messages.
        /// </summary>
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            switch (m.Msg)
            {
            case (int)User32.WM.HSCROLL:
            case (int)User32.WM.VSCROLL:

                // When we scroll, we reposition a control without causing a
                // property change event.  Therefore, we must tell the
                // SelectionManager to refresh its glyphs.
                if (selManager == null)
                {
                    selManager = GetService(typeof(SelectionManager)) as SelectionManager;
                }

                if (selManager != null)
                {
                    selManager.Refresh();
                }

                // Now we must paint our adornments, since the scroll does not
                // trigger a paint event
                //
                Control.Invalidate();
                Control.Update();
                break;
            }
        }
Example #17
0
        public static void Update(double totalMS, double frameMS)
        {
            SortControlsByInfo();

            var first = Gumps.First;

            while (first != null)
            {
                var next = first.Next;

                Control g = first.Value;

                g.Update(totalMS, frameMS);

                if (g.IsDisposed)
                {
                    Gumps.Remove(first);
                }

                first = next;
            }

            GameCursor?.Update(totalMS, frameMS);
            HandleKeyboardInput();
            HandleMouseInput();
        }
Example #18
0
        void IWebViewDelegate.LoadHtml(string html, string baseUrl)
        {
            try
            {
                if (string.IsNullOrEmpty(html))
                {
                    var urlWebViewSource = Element.Source as HtmlWebViewSource;

                    if (urlWebViewSource != null)
                    {
                        html = urlWebViewSource.Html;
                    }
                }

                if (Control != null)
                {
                    Control.DocumentText = html;
                    Control.Update();
                }
            }
            catch (Exception ex)
            {
                Log.Warning("WebView load string", $"WebView load string failed: {ex}");
            }
        }
        private bool initializeProperMenu(string targetPanelName)
        {
            bool rt = false;

            if (!string.IsNullOrEmpty(targetPanelName))
            {
                Control c = this.Controls[targetPanelName];
                if (c != null)
                {
                    c.Enabled = true;
                    c.Visible = true;
                    c.BringToFront();
                    c.Update();
                    this.lastActiveMenuPanel = c;
                    rt = true;
                }
            }

            if (rt == false)
            {
                MessageBox.Show("Could not navigate to child menu { " + targetPanelName + " }",
                                "MenuNavigationError", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(rt);
        }
Example #20
0
 void UpdateCount()
 {
     Control.ClearIndex();
     Control.AppendIndex(Element.Count);
     Control.Update(0);
     UpdatePosition();
 }
Example #21
0
        public static void ResumeDrawing(this Control ctrl)
        {
            if (!ctrl.IsHandleCreated)
            {
                return;
            }
            int?   nNb = 0;
            IntPtr ptr = ctrl.Handle;

            if (ptr == null)
            {
                return;
            }
            if (ptr != null && m_setControlesSuspended.TryGetValue(ptr, out nNb))
            {
                nNb--;
                m_setControlesSuspended[ptr] = nNb;
            }
            if (nNb == null || nNb == 0)
            {
                if (m_setControlesSuspended.ContainsKey(ptr))
                {
                    m_setControlesSuspended.Remove(ptr);
                }
                ctrl.Disposed -= m_disposeHandler;
                SendMessage(ctrl.Handle, WM_SETREDRAW, true, 0);
                ctrl.ResumeLayout();
                ctrl.Invalidate(true);
                ctrl.Update();
                //SendMessage(ctrl.Handle, (int)WindowsMessages.WM_PAINT, 0, 0);
                //ctrl.Refresh();
                //ctrl.Invalidate(true);
            }
        }
Example #22
0
 /// <summary>
 /// Включает перерисовку для Control.
 /// </summary>
 public static void ResumeDrawing(this Control Target)
 {
     SendMessage(Target.Handle, WM_SETREDRAW, true, 0);
     Target.Invalidate(true);
     Target.Parent.Invalidate(true);
     Target.Update();
     Target.Parent.Update();
 }
Example #23
0
 void OnKeyUp(object sender, WForms.KeyEventArgs e)
 {
     if (_keydown)
     {
         _keydown = false;
         Control?.Update();
     }
 }
Example #24
0
 internal static void Ejecutar_Delegado_Control_Update(Control Control)
 {
     try
     {
         Control.Update();
     }
     catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); }
 }
Example #25
0
 private void HabilitarControle(Control controle)
 {
     TaskManagerForm.InvokeControlAction(controle, (arg) =>
     {
         controle.Enabled = true;
         controle.Update();
     });
 }
Example #26
0
        private void control_MouseUp(object sender, MouseEventArgs e)
        {
            if (controlMoviendo == null)
            {
                return;
            }
            Point CurPos  = e.Location;
            Point esquina = new Point(controlMoviendo.Width, controlMoviendo.Height);

            if (e.Button == MouseButtons.Left)
            {
                moviendo = false;
                controlMoviendo.BackColor = anterior;
                controlMoviendo.Update();// = null;

                //aqui verificar si esta sobre un tabControl
                foreach (TabControl tabControl in tabControls)
                {
                    if (controlMoviendo.Location.X > tabControl.Location.X && controlMoviendo.Location.X < tabControl.Location.X + tabControl.Location.X + tabControl.Width)
                    {
                        if (controlMoviendo.Location.Y > tabControl.Location.Y && controlMoviendo.Location.Y < tabControl.Location.Y + tabControl.Location.Y + tabControl.Height)
                        {
                            if (controlMoviendo.Parent.GetType() == typeof(Panel))
                            {
                                controlMoviendo.Parent   = tabControl.SelectedTab;
                                controlMoviendo.Location = new Point(controlMoviendo.Location.X - tabControl.Location.X, controlMoviendo.Location.Y - tabControl.Location.Y);
                                tabControl.SelectedTab.Controls.Add(controlMoviendo);
                            }
                            return;
                        }
                    }
                }
                if (controlMoviendo.Parent.GetType() == typeof(TabPage))
                {
                    Boolean salioDeTab = false;
                    if (controlMoviendo.Location.X < controlMoviendo.Parent.Location.X || controlMoviendo.Location.X > controlMoviendo.Parent.Location.X + controlMoviendo.Parent.Location.X + controlMoviendo.Parent.Width)
                    {
                        salioDeTab = true;
                    }
                    if (controlMoviendo.Location.Y < controlMoviendo.Parent.Location.Y || controlMoviendo.Location.Y > controlMoviendo.Parent.Location.Y + controlMoviendo.Parent.Location.Y + controlMoviendo.Parent.Height)
                    {
                        salioDeTab = true;
                    }
                    if (salioDeTab)
                    {
                        controlMoviendo.Location = new Point(controlMoviendo.Location.X + controlMoviendo.Parent.Parent.Location.X, controlMoviendo.Location.Y + controlMoviendo.Parent.Parent.Location.Y);
                        controlMoviendo.Parent   = pnl_Controles;
                        pnl_Controles.Controls.Add(controlMoviendo);
                    }
                }
            }
            if (e.Button == MouseButtons.Right)
            {
                this.Cursor     = Cursors.Default;
                direccion       = 0;
                controlMoviendo = null;
            }
        }
Example #27
0
        void UpdateFormat()
        {
            _formatString = null;
            // GTK doesn't remember the value if the format changes as it tries to parse the old text with the new format
            Control.Value = Control.Value;

            // update to the new text
            Control.Update();
        }
Example #28
0
        /// <summary>
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="otherScreenHasFocus"></param>
        /// <param name="coveredByOtherScreen"></param>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (RootControl != null)
            {
                RootControl.Update(gameTime);
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
Example #29
0
        /// <summary>
        /// Runsafe e faz form.Cursor = Cursors.WaitCursor
        /// </summary>
        /// <param name="control"></param>
        /// <param name="action"></param>
        public static T RunSafe <T>(Control control, Func <T> func)
        {
            control.Cursor = Cursors.WaitCursor;
            control.Update();
            var ret = RunSafe <T>(func);

            control.Cursor = Cursors.Default;
            return(ret);
        }
Example #30
0
 // Token: 0x06000008 RID: 8 RVA: 0x000022B0 File Offset: 0x000004B0
 private void ChangeLanguage(string lang)
 {
     foreach (object obj in base.Controls)
     {
         Control control = (Control)obj;
         new ComponentResourceManager(typeof(Form1)).ApplyResources(control, control.Name, new CultureInfo(lang));
         control.Update();
     }
 }
Example #31
0
        static void Main(string[] args)
        {
            while (true)
            {
                Control data = new Control();

                System.Console.WriteLine(">> FileSystem TEST");
                System.Console.WriteLine();
                System.Console.WriteLine("1. Open / Create File");
                System.Console.WriteLine("2. Add Element");
                System.Console.WriteLine("3. Update Element");
                System.Console.WriteLine("4. Remove Element");
                System.Console.WriteLine("5. Search Element");
                System.Console.WriteLine("6. Print List");
                System.Console.WriteLine();
                System.Console.WriteLine("0. Close / Quit Program");
                System.Console.WriteLine();
                System.Console.Write("Select Number : ");

                // select menu
                Select? sel = null;
                try
                {
                    sel = (Select)int.Parse(System.Console.ReadLine());
                }
                catch (Exception e) { }
                System.Console.WriteLine();
                switch (sel)
                {
                    case Select.Open: data.Open(); break;
                    case Select.Add: data.Add(); break;
                    case Select.Update: data.Update();  break;
                    case Select.Remove: data.Remove(); break;
                    case Select.Search: data.Search(); break;
                    case Select.List: data.List(); break;
                    case Select.Close: return;
                    default:
                        System.Console.WriteLine(">> Plz input Number (0~6)\n");break;
                }
            }
        }
Example #32
0
        /// <summary>
        /// Scans each of the communication ports listed in the registry to determine if it is connected to target hardware and generates a list
        /// of the target configuration information and the communication settings for each target that is located. 
        /// </summary>
        /// <param name="targetConfigurationList">The list containing the target configuration information for any targets connected to the PTU.</param>
        /// <param name="communicationSettingList">The communication settings associated with each target that was found.</param>
        /// <param name="listBoxTargetsFound">The <c>ListBox</c> control on which the target names are to be displayed.</param>
        /// <param name="statusInformation">The control on which the status information is to be displayed.</param>
        /// <returns>A flag to indicate whether one or more targets were found; true, if  targets were found, otherwise, false.</returns>
        public bool GetTargets(ListBox listBoxTargetsFound, Control statusInformation,  out List<TargetConfiguration_t> targetConfigurationList,
                               out List<CommunicationSetting_t> communicationSettingList)
        {
            // Instantiate to output parameters.
            communicationSettingList = new List<CommunicationSetting_t>();
            targetConfigurationList = new List<TargetConfiguration_t>();

            CommunicationApplication communicationInterface;

            // Flag to indicate whether target hardware was found; true, if one or more targets were found, otherwise, false.
            bool targetFound = false;

			if (Parameter.CommunicationType == Parameter.CommunicationTypeEnum.Both || Parameter.CommunicationType == Parameter.CommunicationTypeEnum.RS232)
			{

				// -----------------------------------------------------------------
				// Scan each serial communication (COM) port listed in the Registry.
				// -----------------------------------------------------------------

				// Get the list of available serial COM ports from the registry.
				RegistryKey root = Registry.LocalMachine;
				CommunicationSetting_t communicationSetting = new CommunicationSetting_t();

				// Set the protocol to serial communication.
				communicationSetting.Protocol = Protocol.RS232;

				// Initialize the serial communication parameters.
				communicationSetting.SerialCommunicationParameters.SetToDefault();

				TargetConfiguration_t targetConfiguration;
				using (RegistryKey serialCommunication = root.OpenSubKey(RegistryKeySerialCommunication))
				{
					// Scan each port in the Registry.
					foreach (string valueName in serialCommunication.GetValueNames())
					{
						// Filter out those '\HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM' keys that are not to be included in the search.
						switch (valueName)
						{
							// Skip those registry keys defined here.
							case SerialCommRegistryKeyWinachsf0:
								continue;
							default:
								// Process the key.
								break;
						}

						string value = serialCommunication.GetValue(valueName).ToString();

						communicationSetting.Port.Name = value;
						communicationSetting.Port.FullSpecification = value.PadRight(ComDeviceTotalCharacters) + " - " + valueName;
						communicationSetting.Port.Type = (communicationSetting.Port.FullSpecification.Contains(VirtualComPort)) ? PortType.VCP : PortType.COM;

						// Determine the port identifier, this is a 16 bit Unicode string representation of the serial port number e.g. for physical and virtual
                        // COM ports this takes the form: 1, 2, 3 ... etc.
						switch (communicationSetting.Port.Type)
						{
							case PortType.COM:
							case PortType.VCP:
								communicationSetting.PortIdentifier = communicationSetting.Port.Name.Remove(0, communicationSetting.Port.Type.ToString().Length);
								break;
							default:
								throw new ArgumentException("FormSelectTargetLogic.LocateTargetHardware()", "communicationSetting.Port.Type");
						}

						statusInformation.Text = Resources.TextSearchingForTargetOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
						statusInformation.Update();

						// Instantiate the appropriate type of communication interface.
						communicationInterface = new CommunicationApplication();
						try
						{
							if (communicationInterface.ScanPort(communicationSetting, out targetConfiguration) == true)
							{
								targetConfigurationList.Add(targetConfiguration);
                                listBoxTargetsFound.Items.Add(targetConfiguration.SubSystemName + " - (COM" + communicationSetting.PortIdentifier + ")" );
								listBoxTargetsFound.Update();
								statusInformation.Text = Resources.TextTargetFoundOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
                                statusInformation.Update();
								communicationSettingList.Add(communicationSetting);
								targetFound = true;
							}
						}
						catch (Exception)
						{
							statusInformation.Text = Resources.TextNoTargetFoundOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
							statusInformation.Update();
							continue;
						}
					}
				}
			}

            statusInformation.Text = string.Empty;
            statusInformation.Update();

			if (Parameter.CommunicationType == Parameter.CommunicationTypeEnum.Both || Parameter.CommunicationType == Parameter.CommunicationTypeEnum.TCPIP)
			{

				// -----------------------------------------------------------------
				// Scan each URI listed in the Data Dictionary.
				// -----------------------------------------------------------------

				CommunicationSetting_t communicationSetting = new CommunicationSetting_t();

				// Set the protocol to IP communication.
				communicationSetting.Protocol = Protocol.TCPIP;

				TargetConfiguration_t targetConfiguration;

                // Initialize the ProgressBar control.
                m_ProgressBarScan.Enabled = true;
                m_ProgressBarScan.Visible = true;
                m_LegendScanProgress.Visible = true;
                m_ProgressBarScan.Maximum = Parameter.URIList.Count;
                m_ProgressBarScan.Value = 0;
                m_BtnOK.Enabled = false;
                m_CancelSelected = false;

				// Scan each port in the Registry.
				foreach (string uRI in Parameter.URIList)
				{
                    // Ensure that the form remains responsive during the asynchronous operation.
                    Application.DoEvents();

                    // Check whether the Cancel button has been selected.
                    if (m_CancelSelected == true)
				{
                        // Yes - Terminate the scan.
                        break;
                    }

                    // Update the progress bar.
                    m_ProgressBarScan.Value++;

					communicationSetting.PortIdentifier = uRI;

                    statusInformation.Text = Resources.TextSearchingForTargetOn + CommonConstants.Space + Resources.TextURI + CommonConstants.Colon +
                                             communicationSetting.PortIdentifier;
                    statusInformation.Update();

					// Instantiate the appropriate type of communication interface.
					communicationInterface = new CommunicationApplication();
					try
					{
						if (communicationInterface.ScanPort(communicationSetting, out targetConfiguration) == true)
						{
							targetConfigurationList.Add(targetConfiguration);
							listBoxTargetsFound.Items.Add(targetConfiguration.SubSystemName + CommonConstants.BindingMessage +
                                                          Resources.TextURI + CommonConstants.Colon + communicationSetting.PortIdentifier);
							listBoxTargetsFound.Update();
                            statusInformation.Text = Resources.TextTargetFoundOn + CommonConstants.Space + Resources.TextURI + CommonConstants.Colon +
                                                     communicationSetting.PortIdentifier;
                            statusInformation.Update();
							communicationSettingList.Add(communicationSetting);
							targetFound = true;
						}
					}
					catch (Exception)
					{
						continue;
					}
				}

                m_BtnOK.Enabled = true;
                m_ProgressBarScan.Enabled = false;
                m_ProgressBarScan.Visible = false;
                m_LegendScanProgress.Visible = false;
			}

            if (targetFound == true)
            {
                statusInformation.Text = targetConfigurationList.Count.ToString() + CommonConstants.Space + Resources.TextTargetsFound;
                statusInformation.Update();

                // Highlight the first logic controller that was found.
                listBoxTargetsFound.SetSelected(0, true);
            }
            else
            {
                statusInformation.Text = Resources.TextNoTargetsFound;
                statusInformation.Update();
            }

            return targetFound;
        }
        public void Run(Control root)
        {
            SDCardManager.Mount();

            // load in the system font
            _systemFont = Font.LoadFromFile("DEJAVU.FNT");

            var timer = new Timer();
            timer.start();

            // for fps info update
            float lastDebugTime = 0;
            float lastUpdateTime = 0;

            string infoString = "";

            while (true)
            {
                FrameTime = timer.read();

                // fixed time step - both for update and draw
                if (FrameTime - lastUpdateTime >= DeltaTime)
                {
                    int touches = Touch.GetTouchInfo();

                    for (int i = 0; i < touches; i++)
                    {
                        // near a touch we have seen recently ?
                        var previous = _activeTouches.Find(x => Math.Abs(x.Position.X - Touch.X[i]) < TouchTrackTolerance &&
                                                                Math.Abs(x.Position.Y - Touch.Y[i]) < TouchTrackTolerance);

                        if (previous == null)
                        {
                            _nextTouchId++;

                            // remember this touch
                            _activeTouches.Add(new TouchInfo { Position = new Point((int)Touch.X[i], (int)Touch.Y[i]), LastSeenTime = FrameTime, Id = _nextTouchId });

                            // new touch so send message to root control
                            root.SendMessage(UIMessage.TouchStart, new TouchEventArgs(_nextTouchId, new Point((int)Touch.X[i], (int)Touch.Y[i])));
                        }
                        else
                        {
                            bool hasMoved = (Math.Abs(previous.Position.X - Touch.X[i]) > 0 || Math.Abs(previous.Position.Y - Touch.Y[i]) > 0);

                            // touch seen again - update for tracking
                            previous.Position = new Point((int)Touch.X[i], (int)Touch.Y[i]);
                            previous.LastSeenTime = FrameTime;

                            // moved at all ?
                            if (hasMoved)
                            {
                                root.SendMessage(UIMessage.TouchMove, new TouchEventArgs(previous.Id, previous.Position));
                            }
                        }
                    }

                    // get rid of old touches
                    for (int i = _activeTouches.Count - 1; i >= 0; i--)
                    {
                        if (FrameTime - _activeTouches[i].LastSeenTime > 0.1f)
                        {
                            root.SendMessage(UIMessage.TouchEnd, new TouchEventArgs(_activeTouches[i].Id, _activeTouches[i].Position));

                            _activeTouches.RemoveAt(i);
                        }
                    }

                    lastUpdateTime = FrameTime;

                    Display.Clear(0xFFFFFFFF);

                    root.Update(DeltaTime);
                    root.Draw();

                    if (ShowDebug)
                    {
                        // show debug info every couple of seconds
                        if (timer.read_ms() - lastDebugTime > 2.0f)
                        {
                            // string.format broken?
                            //infoString = String.Format("FPS: {0} MEMAVAIL: {1} MEMALOC: {2}",
                            //    Display.Fps,
                            //    Microsoft.Zelig.Runtime.MemoryManager.Instance.AvailableMemory,
                            //    Microsoft.Zelig.Runtime.MemoryManager.Instance.AllocatedMemory);

                            infoString = "FPS: " + Display.Fps.ToString() + " MEMAVAIL: " + Microsoft.Zelig.Runtime.MemoryManager.Instance.AvailableMemory.ToString();

                            lastDebugTime = timer.read();
                        }

                        //Display.DrawString(infoString, 0, 0);
                    }

                    // show the back buffer
                    Display.Flip();
                }
            }
        }