示例#1
0
		Control StartStopButton(ProgressBar bar)
		{
			var control = new Button { Text = "Start Timer" };
			control.Click += delegate
			{
				if (timer == null)
				{
					timer = new UITimer { Interval = 0.5 };
					timer.Elapsed += delegate
					{
						if (bar.Value < bar.MaxValue)
							bar.Value += 50;
						else
							bar.Value = bar.MinValue;
					};
					timer.Start();
					control.Text = "Stop Timer";
				}
				else
				{
					timer.Stop();
					timer.Dispose();
					timer = null;
					control.Text = "Start Timer";
				}
			};
			return control;
		}
示例#2
0
 /// <summary>
 /// Perform the initial refresh on load
 /// </summary>
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     _refreshTimer = new UITimer();
     _refreshTimer.Interval = RefreshInterval.TotalSeconds;
     _refreshTimer.Elapsed += _refresh;
     _refreshTimer.Start();
     _refresh(null, null);
 }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var database = BACnetSession.Current.GetProcess<NetworkDatabase>();
            this._devices = new DeviceTreeStore(Application.Instance);
            this._devicesSubscription = database.Subscribe(new DescriptorQuery(objectType: 8), this._devices);
            _tree.DataStore = this._devices;

            _refreshTimer = new UITimer();
            _refreshTimer.Interval = .5;
            _refreshTimer.Elapsed += _refreshTimerElapsed;
            _refreshTimer.Start();
        }
示例#4
0
		public UnitTestSection()
		{
			startButton = new Button { Text = "Start Tests", Size = new Size(200, 80) };
			useTestPlatform = new CheckBox { Text = "Use Test Platform" };
			var buttons = new StackLayout
			{
				Padding = new Padding(10),
				Spacing = 5,
				HorizontalContentAlignment = HorizontalAlignment.Center,
				Items = { startButton, useTestPlatform }
			};

			if (Platform.Supports<TreeView>())
			{

				search = new SearchBox();
				search.Focus();
				search.KeyDown += (sender, e) =>
				{
					if (e.KeyData == Keys.Enter)
					{	
						startButton.PerformClick();
						e.Handled = true;
					}
				};

				var timer = new UITimer();
				timer.Interval = 0.5;
				timer.Elapsed += (sender, e) =>
				{
					timer.Stop();
					PopulateTree(search.Text);
				};
				search.TextChanged += (sender, e) => {
					if (timer.Started)
						timer.Stop();
					timer.Start();
				};

				tree = new TreeView();

				tree.Activated += (sender, e) =>
				{
					var item = (TreeItem)tree.SelectedItem;
					if (item != null)
					{
						RunTests(item.Tag as CategoryFilter);
					}
				};

				Content = new StackLayout
				{
					Spacing = 5,
					HorizontalContentAlignment = HorizontalAlignment.Stretch,
					Items = { buttons, search, new StackLayoutItem(tree, expand: true) }
				};
			}
			else
				Content = buttons;

			startButton.Click += (s, e) => RunTests();
		}