当前位置: 首页>>代码示例>>C#>>正文


C# Control.Update方法代码示例

本文整理汇总了C#中Control.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Control.Update方法的具体用法?C# Control.Update怎么用?C# Control.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Control的用法示例。


在下文中一共展示了Control.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        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;
                }
            }
        }
开发者ID:sysilion,项目名称:FileSystem,代码行数:41,代码来源:Program.cs

示例2: GetTargets

        /// <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;
						}
					}
				}
			}
//.........这里部分代码省略.........
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:101,代码来源:FormSelectTarget.cs

示例3: Run

        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();
                }
            }
        }
开发者ID:roceh,项目名称:stm32f7disco_llilum_lcdtest,代码行数:99,代码来源:Application.cs


注:本文中的Control.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。