示例#1
0
        /// <summary>
        ///     Updates the LCD screen.
        /// </summary>
        private void UpdateApplet(object sender, EventArgs e)
        {
            if (this.applet.IsEnabled && this.lcdDevice != null && !this.lcdDevice.IsDisposed)
            {
                BuildInformationProvider info = new BuildInformationProvider(
                    new ActiveDirectoryBuildInformationAuthorizer(this.tfsUri),
                    new FinishedBuildInformationGetter());
                G19BuildScreenAppletViewModel viewModel = new G19BuildScreenAppletViewModel(info.GetBuildInformation(this.buildDefinition, this.teamProject));
                this.buildScreenApplet.DataContext = viewModel;

                this.lcdDevice.DoUpdateAndDraw();
            }
        }
示例#2
0
        private void OnQvgaDeviceArrived()
        {
            // First device arrival, creates the device
            if (this.lcdDevice == null)
            {
                this.lcdDevice = (LcdDeviceQvga)this.applet.OpenDeviceByType(LcdDeviceType.Qvga);
                this.buildScreenApplet = new G19BuildScreenApplet();

                BuildInformationProvider info = new BuildInformationProvider(
                    new ActiveDirectoryBuildInformationAuthorizer(this.tfsUri),
                    new FinishedBuildInformationGetter());
                G19BuildScreenAppletViewModel viewModel = new G19BuildScreenAppletViewModel(info.GetBuildInformation(this.buildDefinition, this.teamProject));

                this.buildScreenApplet.DataContext = viewModel;

                this.lcdDevice.CurrentPage = new LcdWpfPage(this.lcdDevice) { Element = this.buildScreenApplet };
                this.lcdDevice.SoftButtonsChanged += this.LcdDeviceSoftButtonsChanged;

                // Starts a timer to update the screen
                this.timer = new DispatcherTimer(
                    TimeSpan.FromSeconds(5.0), 
                    DispatcherPriority.Render, 
                    this.UpdateApplet, 
                    Dispatcher.CurrentDispatcher);
            }

            // Subsequent device arrival means the device was removed and replugged, simply reopens it
            else
            {
                this.lcdDevice.ReOpen();
            }

            this.lcdDevice.DoUpdateAndDraw();
        }