public override void OnPageShown()
        {
            if (BluetoothService.Instance.ActiveModel == Model.BudsPlus)
            {
                Title.Content = Loc.GetString("selftest_header_alt");
            }
            else
            {
                Title.Content = Loc.GetString("selftest_header");
            }

            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.RunSelfTest());
            LoadingSpinner.Visibility = Visibility.Visible;
            LoadingSpinner.Start();

            HwVer.TextDetail       = Waiting;
            SwVer.TextDetail       = Waiting;
            TouchFwVer.TextDetail  = Waiting;
            BtAddr.TextDetail      = Waiting;
            Proximity.TextDetail   = Waiting;
            Thermo.TextDetail      = Waiting;
            AdcSoc.TextDetail      = Waiting;
            AdcVoltage.TextDetail  = Waiting;
            AdcCurrent.TextDetail  = Waiting;
            Hall.TextDetail        = Waiting;
            Accelerator.TextDetail = Waiting;
            SelfTestResult.Text    = Waiting;
        }
 private void FactoryReset_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     LoadingSpinner.Visibility = Visibility.Visible;
     LoadingSpinner.Start();
     BackButton.Visibility = Visibility.Hidden;
     BluetoothService.Instance.SendAsync(SPPMessageBuilder.FactoryReset());
     FactoryReset.Text      = Waiting;
     FactoryReset.IsEnabled = false;
 }
        private void Retry_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            LoadingSpinner.Visibility = Visibility.Visible;
            LoadingSpinner.Start();
            Retry.IsEnabled = false;
            Retry.Text      = "Connecting...";

            Task.Delay(50).ContinueWith(t =>
            {
                RetryRequested?.Invoke(this, null);
            });
        }
示例#4
0
        void ShowWaitingSpinner()
        {
            var spinner = new LoadingSpinner();

            mProgressContainer.Add(spinner);
            spinner.Start();

            var checkinMessageLabel = new Label(mProgressControls.ProgressData.ProgressMessage);

            checkinMessageLabel.style.paddingLeft = 10;
            mProgressContainer.Add(checkinMessageLabel);
        }
示例#5
0
 public void SetLoaderVisible(bool b)
 {
     Dispatcher.Invoke(() =>
     {
         LoadingSpinner.Visibility = b ? Visibility.Visible : Visibility.Hidden;
         if (b)
         {
             LoadingSpinner.Start();
         }
         else
         {
             LoadingSpinner.Stop();
         }
     });
 }
        public override void OnPageShown()
        {
            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.RunSelfTest());
            LoadingSpinner.Visibility = Visibility.Visible;
            LoadingSpinner.Start();

            HwVer.TextDetail       = Waiting;
            SwVer.TextDetail       = Waiting;
            TouchFwVer.TextDetail  = Waiting;
            BtAddr.TextDetail      = Waiting;
            Proximity.TextDetail   = Waiting;
            Thermo.TextDetail      = Waiting;
            AdcSoc.TextDetail      = Waiting;
            AdcVoltage.TextDetail  = Waiting;
            AdcCurrent.TextDetail  = Waiting;
            Hall.TextDetail        = Waiting;
            Accelerator.TextDetail = Waiting;
            SelfTestResult.Text    = Waiting;
        }
示例#7
0
        protected override void OnUpdate(float timeStep)
        {
            base.OnUpdate(timeStep);

            float deltaTime = Time.SystemTime - tempTime;

            if (deltaTime > 500)
            {
                loadingSpinner.Start();
            }

            loadingSpinner.UpdateSpinner(timeStep);

            if (dirty)
            {
                loadingSpinner.Stop();
                tempTime = Time.SystemTime;
                dirty    = false;
                OnUpdateHandler?.Invoke();
            }
        }
示例#8
0
        private void PatientImport_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog {
                Multiselect = true
            };

            if (dialog.ShowDialog() == true)
            {
                var spinner = new LoadingSpinner();
                ApplicationManager.SetContent(spinner);

                spinner.Start();
                this.MainMenu.IsEnabled = false;

                SyntheaRunner.ParsingSyntheaData += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Parsing Patient records."); }));
                };

                SyntheaRunner.StoringSyntheaData += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Storing Patient records."); }));
                };

                SyntheaRunner.FinishedSynthea += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(
                        new Action(
                            () =>
                    {
                        this.MainMenu.IsEnabled = true;
                        ApplicationManager.SetContent(new PatientCreation());
                    }));
                };

                var parsedPatients = SyntheaRunner.ParsePatientFromFiles(dialog.FileNames);
                SyntheaRunner.StoreParsedPatients(parsedPatients);
            }
        }
        public override void OnPageShown()
        {
            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetBatteryType());
            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetSerialNumber());
            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetBuildString());
            BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData());
            LoadingSpinner.Visibility = Visibility.Visible;
            LoadingSpinner.Start();

            HwVer.TextDetail        = Waiting;
            SwVer.TextDetail        = Waiting;
            TouchFwVer.TextDetail   = Waiting;
            BtAddr.TextDetail       = Waiting;
            Proximity.TextDetail    = Waiting;
            Thermo.TextDetail       = Waiting;
            AdcSoc.TextDetail       = Waiting;
            AdcVoltage.TextDetail   = Waiting;
            AdcCurrent.TextDetail   = Waiting;
            Hall.TextDetail         = Waiting;
            SerialNumber.TextDetail = Waiting;
            BatteryType.TextDetail  = Waiting;
            BuildString.TextDetail  = Waiting;
        }
示例#10
0
        public override void OnAttachedToNode(Node node)
        {
            base.OnAttachedToNode(node);

            // Create screen Node, scale it accordingly and rotate it so it faces camera
            screenNode       = node.CreateChild("screenNode");
            markerSphereNode = node.CreateChild("markerSphereNode");
            backdropNode     = node.CreateChild("backdrop");

            loadingSpinner = new LoadingSpinner(node.CreateChild("spinner"), 40, 1);

            // Initialize marker sphere pool with arbitrary number of spheres
            Pool = new MarkerSpherePool(20, markerSphereNode);

            backdropNode.Scale = new Vector3(Height, 1, Width);

            // Rotate the camera in the clockwise direction with 90 degrees
            backdropNode.Rotate(new Quaternion(-90, 0, 0), TransformSpace.Local);

            // Apply camera orientation and an offset to match the no rotation position with QTM
            backdropNode.Rotate(new Quaternion(0, 90 - Camera.Orientation, 0), TransformSpace.Local);
            markerSphereNode.Rotate(new Quaternion(0, 0, -Camera.Orientation), TransformSpace.Local);

            // Create marker screen node and its plane
            defaultScreen = backdropNode.CreateComponent <Urho.Shapes.Plane>();
            defaultScreen.SetMaterial(Material.FromColor(Urho.Color.Black, true));

            // Create intensity plane, its material and assign it
            imageScreen    = backdropNode.CreateComponent <Urho.Shapes.Plane>();
            screenMaterial = new Material();

            SetImageTexture(Camera.ImageResolution.Width, Camera.ImageResolution.Height);

            // Set detail info label
            // TODO: Fix magic numbers
            nodeDetailTextLabel = screenNode.CreateChild();
            textLabel           = nodeDetailTextLabel.CreateComponent <Text3D>();

            if (Camera.Orientation == 0)
            {
                nodeDetailTextLabel.Position = new Vector3(-Width / 2 + 0.2f, -Height / 2 + 0.7f, -0.1f);
            }
            else
            {
                nodeDetailTextLabel.Position = new Vector3(-Height / 2 + 0.2f, -Width / 2 + 0.7f, -0.1f);
            }

            textLabel.Text = Camera.ID.ToString();
            textLabel.SetFont(CoreAssets.Fonts.AnonymousPro, 55);
            textLabel.TextEffect = TextEffect.Stroke;

            // Set grid view info label
            nodeGridTextLabel = screenNode.CreateChild();
            textLabel         = nodeGridTextLabel.CreateComponent <Text3D>();

            if (Camera.Orientation == 0)
            {
                nodeGridTextLabel.Position = new Vector3(-Width / 2 + 0.2f, -Height / 2 + 1f, -0.1f);
            }
            else
            {
                nodeGridTextLabel.Position = new Vector3(-Height / 2 + 0.2f, -Width / 2 + 1f, -0.1f);
            }

            textLabel.Text = Camera.ID.ToString();
            textLabel.SetFont(CoreAssets.Fonts.AnonymousPro, 100);
            textLabel.TextEffect = TextEffect.Stroke;

            // Create a node and a text object to display messages centered in the camera screen
            nodeTextMessage = screenNode.CreateChild();
            textMessage     = nodeTextMessage.CreateComponent <Text3D>();
            textMessage.SetFont(CoreAssets.Fonts.AnonymousPro, 35);
            textMessage.TextEffect = TextEffect.Stroke;
            textMessage.Text       = "Intensity/Video mode is disabled in slave mode";

            textMessage.VerticalAlignment   = VerticalAlignment.Center;
            textMessage.HorizontalAlignment = HorizontalAlignment.Center;
            textMessage.TextAlignment       = HorizontalAlignment.Center;
            nodeTextMessage.Enabled         = false;
            nodeTextMessage.Position        = new Vector3(0.0f, 0.0f, -0.1f);

            // Disable both label nodes at start
            nodeGridTextLabel.Enabled   = false;
            nodeDetailTextLabel.Enabled = false;

            // Initialize current camera mode
            SetImageMode(Camera.IsImageMode());

            // Subscribe to messages
            SubscribeToDataEvents();

            // Create frame
            CreateFrame(screenNode, 0.04f);

            // Start with loading spinner enabled
            loadingSpinner.Start();
        }
示例#11
0
        private void InitializeSynthea()
        {
            var spinner = new LoadingSpinner();

            ApplicationManager.SetContent(spinner);

            spinner.Start();
            this.MainMenu.IsEnabled = false;

            SyntheaInstaller.VersionCheck += (sender, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Checking Synthea Version"); }));
            };
            SyntheaInstaller.DownloadLatest += (sender, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Downloading Latest Synthea"); }));
            };
            SyntheaInstaller.InstallLatest += (sender, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Installing Latest Synthea"); }));
            };
            SyntheaInstaller.SetupComplete += (sender, args) =>
            {
                this.Dispatcher.BeginInvoke(
                    new Action(
                        () =>
                {
                    this.MainMenu.IsEnabled = true;

                    var patients = ApplicationManager.PatientRepository.LoadPatients();
                    if (patients.Count > 0)
                    {
                        ApplicationManager.SetContent(new PatientList(patients));
                    }
                    else
                    {
                        ApplicationManager.SetContent(new PatientCreation());
                    }
                }));
            };

            Task.Run(() =>
            {
                try
                {
                    ApplicationManager.CurrentSyntheaVersion = SyntheaInstaller.InstallOrUpdate();
                }
                catch (JavaNotInstalledException)
                {
                    this.Dispatcher.BeginInvoke(
                        new Action(
                            () =>
                    {
                        MessageBox.Show(
                            "Synthea needs the Java 1.8 JDK or higher to be installed. Please go to https://www.oracle.com/technetwork/java/javase/downloads/index.html and install the latest JDK version.",
                            "Java not installed or incorrect version!");

                        Application.Current.Shutdown();
                    }));
                }
                catch (JavaHomeNotSetException)
                {
                    this.Dispatcher.BeginInvoke(
                        new Action(
                            () =>
                    {
                        MessageBox.Show(
                            "Please set the java home variable to your JDK installation (see https://www.google.com/search?q=how+to+set+java_home&oq=how+to+set+java)",
                            "Java path (JAVA_HOME) not set!");

                        Application.Current.Shutdown();
                    }));
                }
                catch (Exception exception)
                {
                    this.Dispatcher.BeginInvoke(
                        new Action(
                            () =>
                    {
                        MessageBox.Show(exception.StackTrace, exception.Message);
                        Application.Current.Shutdown();
                    }));
                }
            });
        }