Start() public method

public Start ( ) : void
return void
        private void ButFluct_Click(object sender, RoutedEventArgs e)
        {
            FluctStatus1 = !FluctStatus1;
            if (FluctStatus1)
            {
                FluctStatusString1 = "on";
                fluctTimer.Start();
                bool test1 = (double.TryParse(txtFluctWidth.Text, out fluctWidth));
                bool test2 = (double.TryParse(txtFluctTime.Text, out fluctTime));

                if (test1 == false || test2 == false)
                {
                    FluctStatus1       = false;
                    FluctStatusString1 = "fail";
                }
            }
            else
            {
                FluctStatusString1 = "off";
            }

            if (FluctStatus1 || FluctStatus2)
            {
                FluctStatus = true;
                fluctTimer.Start();
            }

            if (FluctStatus1 == false && FluctStatus2 == false)
            {
                FluctStatus = false;
                fluctTimer.Stop();
            }
        }
Beispiel #2
0
        public async Task Load()
        {
            var x = 0;
            var max = 20;
            var y = 0;

            var items = ResourceFileParser.GetKeysBasedOn(@"Common\StandardStyles.xaml", "AppBarButtonStyle");
            t = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(50) };
            t.Tick += (s, e) =>
                          {
                              t.Stop();

                              for (int index = x; index < items.Count; index++)
                              {
                                  y++;
                                  var i = items[index];
                                  buttonGroup.Items.Add(i);

                                  if (y % max == 0)
                                  {
                                      x = index;
                                      if (y < items.Count)
                                          t.Start();
                                      break;
                                  }
                              }
                          };

            t.Start();
        }
Beispiel #3
0
 private void forwardBut_Click(object sender, RoutedEventArgs e)
 {
     vis.setView();
     setLightRate();
     setSoundRate();
     setTHRate();
     _timer_1.Start();
     _timer_2.Start();
     _timer_3.Start();
 }
        // *** Methods ***

        public static async void InjectAsyncExceptions(Task task)
        {
            // Await the task to allow any exceptions to be thrown

            try
            {
                await task;
            }
            catch (Exception e)
            {
                // If we are currently on the core dispatcher then we can simply rethrow the exception
                // NB: This will occur if awaiting the task returned immediately

                CoreDispatcher dispatcher = CoreApplication.GetCurrentView().CoreWindow.Dispatcher;

                if (dispatcher.HasThreadAccess)
                    throw;

                // Otherwise capture the exception with its original stack trace

                ExceptionDispatchInfo exceptionDispatchInfo = ExceptionDispatchInfo.Capture(e);

                // Re-throw the exception via a DispatcherTimer (this will then be captured by the Application.UnhandledException event)

                DispatcherTimer timer = new DispatcherTimer();
                timer.Tick += (sender, args) =>
                {
                    timer.Stop();
                    exceptionDispatchInfo.Throw();
                };
                timer.Start();
            }
        }
Beispiel #5
0
 public void init()
 {
     DispatcherTimer tmr = new DispatcherTimer();
     tmr.Interval = TimeSpan.FromSeconds(1);
     tmr.Tick += Draw;
     tmr.Start();
 }
 public void DispatcherTimerSetup()
 {
     dispatcherTimer = new DispatcherTimer();
     dispatcherTimer.Tick += dispatcherTimer_Tick;
     dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
     dispatcherTimer.Start();
 }
 public MainPage()
 {
     InitializeComponent();
     DispatcherTimer timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
     timer.Tick += Timer_Tick;
     timer.Start();
 }
        public TutorialMainPage()
        {
            this.InitializeComponent();

#if !ALWAYS_SHOW_BLINKY
            if (DeviceTypeInformation.Type != DeviceTypes.RPI2 && DeviceTypeInformation.Type != DeviceTypes.DB410)
            {
                TutorialList.Items.Remove(HelloBlinkyGridViewItem);
            }
#endif
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            this.DataContext = LanguageManager.GetInstance();

            this.Loaded += (sender, e) =>
            {
                UpdateBoardInfo();
                UpdateDateTime();

                timer = new DispatcherTimer();
                timer.Tick += timer_Tick;
                timer.Interval = TimeSpan.FromSeconds(30);
                timer.Start();
            };
            this.Unloaded += (sender, e) =>
            {
                timer.Stop();
                timer = null;
            };
        }
        private void LoadData()
        {
            if (dispatcherTimer == null)
            {
                dispatcherTimer = new DispatcherTimer();
                dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 5);
                dispatcherTimer.Tick += DispatcherTimer_Tick;

                dispatcherTimer.Start();
            }

            if (Accounts == null)
                Accounts = new ObservableCollection<Account>();
            else
                Accounts.Clear();

            foreach (Account a in App.Accounts)
            {
                Accounts.Add(a);
            }

            if (Accounts.Count > 0)
            {
                this.prgStatusBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
                this.txtEmpty.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                this.prgStatusBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                this.txtEmpty.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
        }
        async void OnButtonClick(object sender, RoutedEventArgs e) {
            MessageDialog msgdlg = new MessageDialog("Choose a color", "How to Async #1");
            msgdlg.Commands.Add(new UICommand("Red", null, Colors.Red));
            msgdlg.Commands.Add(new UICommand("Green", null, Colors.Green));
            msgdlg.Commands.Add(new UICommand("Blue", null, Colors.Blue));

            // Start a five-second timer
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(5);
            timer.Tick += OnTimerTick;
            timer.Start();

            // Show the MessageDialog
            asyncOp = msgdlg.ShowAsync();
            IUICommand command = null;

            try {
                command = await asyncOp;
            }
            catch (Exception) {
                // The exception in this case will be TaskCanceledException
            }

            // Stop the timer
            timer.Stop();

            // If the operation was canceled, exit the method
            if (command == null) {
                return;
            }

            // Get the Color value and set the background brush
            Color clr = (Color)command.Id;
            contentGrid.Background = new SolidColorBrush(clr);
        }
 private void layout(StackPanel panel)
 {
     for (int i = 0; i < 8; i++)
     {
         panel.Children.Add(new Digital()
         {
             Digit = 10,
             Height = 50,
             Margin = new Thickness(5)
         });
     }
     DispatcherTimer timer = new DispatcherTimer()
     {
         Interval = TimeSpan.FromMilliseconds(250)
     };
     timer.Tick += (object sender, object e) =>
     {
         string time = DateTime.Now.ToString("HH:mm:ss");
         for (int i = 0; i < 8; i++)
         {
             string interval = time[i].ToString();
             ((Digital)panel.Children[i]).Digit =
             interval == ":" ? 11 : int.Parse(interval);
         }
     };
     timer.Start();
 }
Beispiel #12
0
 public FlyPage()
 {
     this.InitializeComponent();
     //if (Application.Current.Resources.ContainsKey("DroneClient"))
     //{
     //    _droneClient = (DroneClient)Application.Current.Resources["DroneClient"];
     //}
     //else
     //{
     //    _droneClient = new DroneClient();
     //}
     _droneClient = DroneClient.Instance;
     //Register joysticks
     if (_droneClient.InputProviders.Count == 0)
     {
         _droneClient.InputProviders.Add(new XBox360JoystickProvider(_droneClient));
         _droneClient.InputProviders.Add(new SoftJoystickProvider(_droneClient, RollPitchJoystick, YawGazJoystick));
     }
     this.DataContext = _droneClient;
     this.DefaultViewModel["Messages"] = _droneClient.Messages;
     _Timer = new DispatcherTimer();
     _Timer.Tick += _Timer_Tick;
     _Timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
     _Timer.Start();
 }
        public async void LoadData()
        {
            IsDataLoaded = false;

            OnAir = await RadioBox2Service.GetNowOnAir(Item.Channel.ToString());
            Broadcast = await RadioBox2Service.GetCurrentBroadcast(Item.Channel.ToString());

            if (_nowOnAirRefreshTimer == null)
            {
                _nowOnAirRefreshTimer = new DispatcherTimer();
                _nowOnAirRefreshTimer.Interval = DateTime.Now.AddMilliseconds(30000) - DateTime.Now;
                _nowOnAirRefreshTimer.Tick += new EventHandler<object>(LoadOnAir);
                _nowOnAirRefreshTimer.Start();
            }

            if (_broadcastRefreshTimer == null)
            {
                _broadcastRefreshTimer = new DispatcherTimer();
                _broadcastRefreshTimer.Interval = DateTime.Now.AddMilliseconds(120000) - DateTime.Now;
                _broadcastRefreshTimer.Tick += new EventHandler<object>(LoadBroadcast);
                _broadcastRefreshTimer.Start();
            }

            LoadProgramme();
            IsDataLoaded = true;
        }
Beispiel #14
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            // Initialize AI telemetry in the app.
            WindowsAppInitializer.InitializeAsync();

            // Timer uploading hearbeat telemetry event
            HeartbeatTimer = new DispatcherTimer();
            HeartbeatTimer.Tick += HeartbeatTimer_Tick;
            HeartbeatTimer.Interval = new TimeSpan(0, heartbeatInterval, 0);    // tick every heartbeatInterval
            HeartbeatTimer.Start();

            // Retrieve and set environment settings
            OSVersion = EnvironmentSettings.GetOSVersion();
            appVersion = EnvironmentSettings.GetAppVersion();
            deviceName = EnvironmentSettings.GetDeviceName();
            ipAddress = EnvironmentSettings.GetIPAddress();

            

            this.InitializeComponent();
            this.Suspending += OnSuspending;
            this.Resuming += OnResuming;

            Controller = new AppController();
        }
 private void InitializeTimer()
 {
     _timer = new DispatcherTimer();
     _timer.Interval = TimeSpan.FromMilliseconds(100);
     _timer.Tick += Tick;
     _timer.Start();
 }
        public MainPage()
        {
            this.InitializeComponent();

            fileSetting = TextToFileSetting(fileSettingStr);
            randomSetting = TextToRandomSetting(randomSettingStr);
            serialSetting = TextToSerialSetting(serialSettingStr);
            remoteSetting = TextToRemoteSetting(remoteSettingStr);

            comboBoxDataSource.Items.Add(DataSourceFileStr);
            comboBoxDataSource.Items.Add(DataSourceSerialStr);
            comboBoxDataSource.Items.Add(DataSourceRandomStr);
            comboBoxDataSource.Items.Add(DataSourceRemoteClientStr);

            comboBoxStreaming.Items.Add(StreamNothingStr);
            comboBoxStreaming.Items.Add(StreamLogStr);
            comboBoxStreaming.Items.Add(StreamPowerStr);
            comboBoxStreaming.Items.Add(StreamBothStr);
            comboBoxStreaming.Items.Add(StreamRealDataStr);

            dTimerUpdateData = new DispatcherTimer();
            dTimerUpdateData.Tick += UpdateDataTick;
            dTimerUpdateData.Interval = new TimeSpan(0, 0, 0, 0, 250);
            dTimerUpdateData.Start();

            dTimerUpdateText = new DispatcherTimer();
            dTimerUpdateText.Tick += UpdateTextTick;
            dTimerUpdateText.Interval = new TimeSpan(0, 0, 0, 1, 0);

        }
        //    public ObservableCollection<Model> Models { get; set; }
        public NodesViewPage()
        {
            this.InitializeComponent();

            App.serialController.OnNewNodeEvent += AddNode;
            App.serialController.OnNodeUpdatedEvent += UpdateNode;
            App.serialController.OnSensorUpdatedEvent += UpdateSensor;
            App.serialController.OnClearNodesList += OnClearNodesList;

            if (App.serialController.IsConnected())
            {
                textBlock3.Visibility = Visibility.Collapsed;
                itemsControl1.Visibility = Visibility.Visible;
                ShowNodes();
            }
            else
            {
                textBlock3.Text = "Device is not connected";
                textBlock3.Visibility = Visibility.Visible;
                itemsControl1.Visibility = Visibility.Collapsed;
            }

            refrashTimer = new DispatcherTimer();
            refrashTimer.Interval = TimeSpan.FromMilliseconds(100);
            refrashTimer.Tick += RefrashInfoTimer;
            refrashTimer.Start();
        }
 private void InitTimer()
 {
     timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Interval = TimeSpan.FromMilliseconds(1000);
     timer.Start();
 }
        private async Task StartScenarioAsync()
        {
            string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
            IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);

            // 0x40 was determined by looking at the datasheet for the HTU21D sensor.
            var HTU21D_settings = new I2cConnectionSettings(0x40);

            // If this next line crashes with an ArgumentOutOfRangeException,
            // then the problem is that no I2C devices were found.
            //
            // If the next line crashes with Access Denied, then the problem is
            // that access to the I2C device (HTU21D) is denied.
            //
            // The call to FromIdAsync will also crash if the settings are invalid.
            //
            // FromIdAsync produces null if there is a sharing violation on the device.
            // This will result in a NullReferenceException in Timer_Tick below.
            htu21dSensor = await I2cDevice.FromIdAsync(devices[0].Id, HTU21D_settings);

            // Start the polling timer.
            timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(500) };
            timer.Tick += Timer_Tick;
            timer.Start();
        }
Beispiel #20
0
        public MainPage(SplashScreen splashScreen)
        {
            this.InitializeComponent();

            // initialize extended splash
            splash = splashScreen;
            SetExtendedSplashBackgroundColor();

            // ensure we are aware of app window being resized
            OnResize();
            Window.Current.SizeChanged += onResizeHandler = new WindowSizeChangedEventHandler((o, e) => OnResize(e));
            Window.Current.VisibilityChanged += OnWindowVisibilityChanged;

            // ensure we listen to when unity tells us game is ready
            WindowsGateway.UnityLoaded = OnUnityLoaded;

            // create extended splash timer
            extendedSplashTimer = new DispatcherTimer();
            extendedSplashTimer.Interval = TimeSpan.FromMilliseconds(100);
            extendedSplashTimer.Tick += ExtendedSplashTimer_Tick;
            extendedSplashTimer.Start();

            // configure settings charm
            settingsPane = SettingsPane.GetForCurrentView();
            settingsPane.CommandsRequested += OnSettingsCommandsRequested;

            // configure share charm
            var dataTransferManager = DataTransferManager.GetForCurrentView();
            dataTransferManager.DataRequested += DataTransferManager_DataRequested;

        }
        public AccessoriesPenPage()
        {
            InitializeComponent();

            var timer = new Windows.UI.Xaml.DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(500)
            };

            timer.Start();

            timer.Tick += (sender, args) =>
            {// well this works? but ew
                timer.Stop();
                ReadyScreen = FlipViewPage.Current.GetAccessoriesPenPopup();
                AccessoriesPenPopupPage.Current.CloseButton_Clicked += CloseButton_Clicked;
            };

            this.rBtnPen.Clicked += OnPenTryItClicked;

            this.ColoringBook.ColorIDChanged       += BookColorIDChanged;
            this.ColoringBook.OnPenScreenContacted += OnPenScreenContacted;

            this.SurfaceDial.ColorIDChanged             += DialColorIDChanged;
            this.SurfaceDial.OnDialScreenContactStarted += OnDialScreenContacted;

            this.Loaded += AccessoriesPenPage_Loaded;
        }
        // PlayNextImage
        // Called when a new image is displayed due to a timeout.
        // Removes the current image object and queues a new next image.
        // Sets the next image index as the new current image, and increases the size
        // of the new current image. Then sets the timeout to display the next image.

        private async void PlayNextImage(int num)
        {
            // Stop the timer to avoid repeating.
            if (timer != null)
            {
                timer.Stop();
            }

            await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                      async() =>
            {
                SlideShowPanel.Children.Remove((UIElement)(SlideShowPanel.FindName("image" + num)));
                var i = await QueueImage(num + 2, false);

                currentImage = num + 1;
                ((Image)SlideShowPanel.FindName("image" + currentImage)).Width = imageSize;
            });

            timer          = new Windows.UI.Xaml.DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, timeLapse);
            timer.Tick    += delegate(object sender, object e)
            {
                PlayNextImage(num + 1);
            };
            timer.Start();
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter.GetType() == typeof(EquationHandler))
            {
                equationHandler = e.Parameter as EquationHandler;

                equationHandler.equationText = this.Equation;

                equationHandler.CursorUpdate();

                CheckAngleType();
            }
            else
            {
                equationHandler = new EquationHandler(this.Equation);

                DispatcherTimer timer = new DispatcherTimer();

                timer.Interval = TimeSpan.FromSeconds(0.5);
                timer.Tick += new EventHandler<object>(Timer_Tick);
                timer.Start();
            }

            this.Frame.KeyDown += Equation_KeyDown;
            this.Frame.KeyUp += Equation_KeyUp;
        }
Beispiel #24
0
 public override void Start()
 {
     _timer = new DispatcherTimer();
     _timer.Tick += _timer_Tick;
     _timer.Interval = new TimeSpan(0, 0, 0, 1);
     _timer.Start();
 }
        public MainPage(Frame frame)
        {
            this.InitializeComponent();
            this.MySplitView.Content = frame;
            title = new Title();
            loggedIn = new Title();
            DataContext = title;

            rdLogin.DataContext = loggedIn;

            loggedIn.Value = Parse.ParseUser.CurrentUser == null ? "Login" : "Profile";


            DispatcherTimer dt = new DispatcherTimer();
            dt.Interval = TimeSpan.FromSeconds(1);
           
            d = DateTime.Parse("2/27/2016 13:00:00 GMT");
            dt.Tick += Dt_Tick;
            txtCountDown.Loaded += (s, e) => { dt.Start(); };
            

            MySplitView.PaneClosed += (s, e) => { bgPane.Width = 48; };
            root = this;
            rootFrame = MySplitView.Content as Frame;
        }
 private void InitTimer()
 {
     timer = new DispatcherTimer();
     timer.Interval = new TimeSpan(0, 0, 2);
     timer.Tick += TimerTick;
     timer.Start();
 }
Beispiel #27
0
        async void tmrPollSlow_TickAsync(object sender, object e)
        {
            //This is the "Slow" Timer that updates the temperature, small thumbnails
            tmrPollSlow.Stop();
            if (this.MyInfo.CurrentTemp.GetNeeded() && !this.IsDimmed)
            {
                try
                {
                    txtCurrentTemp.Text = await HelperMethods.GetCurrentTempAsync(txtTempQuery.Text);

                    MyInfo.CurrentTemp.DisplayString = txtCurrentTemp.Text;
                    MyInfo.CurrentTemp.LastRetrieved = DateTime.Now;
                    LogMessage("Got current temp");
                }
                catch (Exception ex)
                {
                    LogMessage("Error getting weather: " + ex.ToString());
                }
            }
            if (!String.IsNullOrWhiteSpace(MyInfo.BIServer) && !this.IsDimmed)
            {
                try
                {
                    String BIBaseURL = MyInfo.BIServer;
                    if (!BIBaseURL.EndsWith("/"))
                    {
                        BIBaseURL += "/";
                    }
                    BIBaseURL += "image/";
                    Int32 ThumbCounter = 1;
                    foreach (WebDownloadInfo CamInfo in MyInfo.SecurityCams)
                    {
                        if (!CamInfo.IsPrimary && CamInfo.GetNeeded())
                        {
                            BitmapImage image = await HelperMethods.GetBlueIrisImage(BIBaseURL, CamInfo.DisplayString);

                            for (int count = 0; count < SecurityCamImages.Count; count++)
                            {
                                if (SecurityCamImages[count].Tag.ToString() == CamInfo.DisplayString)
                                {
                                    SecurityCamImages[count].Source = image as ImageSource;
                                    CamInfo.LastRetrieved           = DateTime.Now;
                                    ThumbnailHackTemp(ThumbCounter, SecurityCamImages[count].Source);
                                    ThumbCounter += 1;
                                    if (ThumbCounter > 3)
                                    {
                                        ThumbCounter = 1;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogMessage("Error getting cam image: " + ex.ToString());
                }
            }
            tmrPollSlow.Start();
        }
Beispiel #28
0
        //------Zwykły timer do Measurement-------------------------------------------------------------

        //-----------------D-E-l-A-Y--------------------------------------------------------------------
        /// <summary>
        /// Delay
        /// </summary>
        /// <param name="i">delay in seconds</param>
        /// <param name="j">dealy in milliseconds</param>
        public void Start_Delay(int i ,int j)
        {
            Delay=new DispatcherTimer();
            Delay.Tick+=Delay_Tick;
            Delay.Interval=new TimeSpan(00, 0, 0, i, j);
            Delay.Start();
        }
        public MainPage()
        {
            


            this.InitializeComponent();

            TheFlipView.Items[0] = new HelpDesk();
            TheFlipView.Items[1] = new PowerView();
            TheFlipView.Items[2] = new NetworkM();
            TheFlipView.Items[3] = new VirtualE();
               //Configure the timer
            _timer = new DispatcherTimer
            {
                //Set the interval between ticks (in this case 8 seconds to see it working)
                Interval = TimeSpan.FromSeconds(8)
            };
            if (count == 0)
            { //Start the timer
                _timer.Start();
             
                //Change what's displayed when the timer ticks
                count++;
            }
          
            _timer.Tick += ChangePage;
            
          


          //  this.Loaded += MainPage_Loaded;
        }
 protected override void OnApplyTemplate()
 {
     _txtMemoryUsage = (TextBlock)GetTemplateChild("txtMemoryUsage");
     var timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Start();
 }
 public void onLoad(object o, RoutedEventArgs e)
 {
     DispatcherTimer tmr = new DispatcherTimer();
     tmr.Interval = TimeSpan.FromSeconds(1);
     tmr.Tick += Draw;
     tmr.Start();
 }
 /// <summary>
 /// 計時開始
 /// </summary>
 private void timer_start()
 {
     timer = new DispatcherTimer();
     timeInit();
     timer.Tick += timer_tick;
     timer.Start();
 }
        private async void GetPreviewFrameButton_Click(object sender, RoutedEventArgs e)
        {
            // If preview is not running, no preview frames can be acquired
            if (!_isPreviewing)
            {
                return;
            }


            if ((ShowFrameCheckBox.IsChecked == true) || (SaveFrameCheckBox.IsChecked == true))
            {
                await GetPreviewFrameAsSoftwareBitmapAsync();
            }
            else
            {
                await GetPreviewFrameAsD3DSurfaceAsync();
            }
            if (Timer.IsEnabled)
            {
                Timer.Stop();
            }
            else
            {
                Timer.Start();
            }
        }
        /// <summary>
        /// Creates a form which displays the status for a UA server.
        /// </summary>
        /// <param name="server">The server displayed in the form.</param>
        /// <param name="configuration">The configuration used to initialize the server.</param>
        public void Initialize(StandardServer server, ApplicationConfiguration configuration)
        {
            m_server = server;
            m_configuration = configuration;

            m_dispatcherTimer = new DispatcherTimer();
            m_dispatcherTimer.Tick += UpdateTimerCTRL_Tick;
            m_dispatcherTimer.Interval = new TimeSpan(0, 0, 5); // tick every 5 seconds
            m_dispatcherTimer.Start();

            // add the urls to the drop down.
            UrlCB.Items.Clear();

            foreach (EndpointDescription endpoint in m_server.GetEndpoints())
            {
                if (!UrlCB.Items.Contains(endpoint.EndpointUrl))
                {
                    UrlCB.Items.Add(endpoint.EndpointUrl);
                }
            }

            if (UrlCB.Items.Count > 0)
            {
                UrlCB.SelectedIndex = 0;
            }
        }
Beispiel #35
0
        public MainPage()
        {
            InitializeComponent();

            machineTexts = new TextBlock[4, 2];
            machineTexts[0, 0] = wash1;
            machineTexts[1, 0] = wash2;
            machineTexts[2, 0] = wash3;
            machineTexts[3, 0] = wash4;
            machineTexts[0, 1] = dry1;
            machineTexts[1, 1] = dry2;
            machineTexts[2, 1] = dry3;
            machineTexts[3, 1] = dry4;

            Debug.WriteLine("MainPage creating board");
            board = new Board();

            Debug.WriteLine("MainPage openning board");
            if (board.TryOpenBoard())
            {
                Debug.WriteLine("MainPage starting timer");
                timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromSeconds(5);
                timer.Tick += Timer_Tick;
                timer.Start();
            }
            else
            {
                Debug.WriteLine("MainPage unable to open board");
                errorText.Text = "בעיה בפתיחת הלוח. בדוק חיבורים והפעל מחשב מחדש.";
            }
        }
 private void initTimer()
 {
     weathertimer = new DispatcherTimer();
     weathertimer.Interval = TimeSpan.FromHours(1); 
     weathertimer.Tick += Timer_Tick;
     weathertimer.Start();
 }
        public MainPage()
        {
            this.InitializeComponent();
            deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Http1);

            DispatcherTimer timer = new Windows.UI.Xaml.DispatcherTimer();

            timer.Tick    += TimerTick;
            timer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            timer.Start();
        }
Beispiel #38
0
        public void Start_timer()
        {
            //initialize timer
            initializeTimer();
            // Keep track of states
            stateOfTimer = 0;
            timer        = new DispatcherTimer();
            // set tick events
            timer.Tick    += timer_Tick;
            timer.Interval = new TimeSpan(00, 0, 1);
            bool enabled = timer.IsEnabled;

            timer.Start();
            // timerProgress.IsEnabled = false;
        }
        public ParameterController()
        {
            this.InitializeComponent();

            updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            updateTimer.Tick    += UpdateTimer_Tick;
            updateTimer.Start();

            fluctTimer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            fluctTimer.Tick    += FluctTimer_Tick;


            initialized = true;

            ControllerMode(DualControllerMode);
        }
Beispiel #40
0
        /// <summary>
        /// Starts recording, data is stored in memory
        /// </summary>
        /// <param name="filePath"></param>
        public async void startRecording(string filePath)
        {
            if (this.player != null)
            {
                this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorPlayModeSet), false);
            }
            else
            {
                try
                {
                    var mediaCaputreSettings = new MediaCaptureInitializationSettings();
                    mediaCaputreSettings.StreamingCaptureMode = StreamingCaptureMode.Audio;
                    audioCaptureTask = new MediaCapture();
                    await audioCaptureTask.InitializeAsync(mediaCaputreSettings);

                    var mediaEncodingProfile = MediaEncodingProfile.CreateMp3(AudioEncodingQuality.Auto);
                    var storageFile          = await KnownFolders.MusicLibrary.CreateFolderAsync("folder", CreationCollisionOption.OpenIfExists);

                    var storageFile1 = await storageFile.CreateFileAsync("1.wav", CreationCollisionOption.ReplaceExisting);

                    var timer = new Windows.UI.Xaml.DispatcherTimer();
                    timer.Tick += async delegate(object sender, object e)
                    {
                        timer.Stop();
                        await audioCaptureTask.StopRecordAsync();

                        this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaState, PlayerState_Stopped), false);

                        if (storageFile != null)
                        {
                        }
                    };
                    timer.Interval = TimeSpan.FromMilliseconds(captureAudioDuration * 1000);


                    await audioCaptureTask.StartRecordToStorageFileAsync(mediaEncodingProfile, storageFile1);

                    timer.Start();

                    this.SetState(PlayerState_Running);
                }
                catch (Exception)
                {
                    this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorStartingRecording), false);
                }
            }
        }
Beispiel #41
0
        public MainPage()
        {
            this.InitializeComponent();
            DispatcherTimer clock = new Windows.UI.Xaml.DispatcherTimer();

            clock.Tick    += clock_Tick;
            clock.Interval = new TimeSpan(0, 0, 1);
            clock.Start();

            DispatcherTimer refresh = new Windows.UI.Xaml.DispatcherTimer();

            refresh.Tick    += refresh_Tick;
            refresh.Interval = new TimeSpan(1, 0, 0);
            refresh.Start();

            AggiornaForm();
        }
Beispiel #42
0
        public MainPage()
        {
            this.InitializeComponent();
            this.IsDimmed = false;
            this.FirstRun = true;

            tmrPollFast          = new Windows.UI.Xaml.DispatcherTimer();
            tmrPollFast.Interval = new TimeSpan(0, 0, FastPollSeconds);
            tmrPollFast.Tick    += tmrPollFast_TickAsync;
            tmrPollFast.Start();

            tmrPollSlow          = new Windows.UI.Xaml.DispatcherTimer();
            tmrPollSlow.Interval = new TimeSpan(0, 0, SlowPollSeconds);
            tmrPollSlow.Tick    += tmrPollSlow_TickAsync;
            tmrPollSlow.Start();

            this.PointerPressed += MyMouseEvent_PointerPressed;
        }
Beispiel #43
0
        public ExperiencePerformancePage()
        {
            InitializeComponent();
            ExperiencePerformancePage.Current = this;
            var timer = new Windows.UI.Xaml.DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };

            timer.Start();
            timer.Tick += (sender, args) =>
            {// well this works? but ew
                timer.Stop();
                this.rBtnTop.PopupChild = FlipViewPage.Current.GetExperiencePagePopup();
                ExperiencePopupPage.Current.CloseButton_Clicked += CloseButton_Clicked;
            };

            this.rBtnLeft.PopupChild  = this.PopLeft;
            this.rBtnRight.PopupChild = this.PopRight;
            this.Loaded += ExperiencePerformancePage_Loaded;
        }
Beispiel #44
0
        private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            dispatcherTimer          = new DispatcherTimer();
            dispatcherTimer.Tick    += dispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
            /*Vi hämtar antal minuter mellan hämtning från office 365*/
            dispatcherTimerTimme       = new DispatcherTimer();
            dispatcherTimerTimme.Tick += dispatcherTimerTimme_Tick;
            var    localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Object valueUppd     = localSettings.Values["Uppdatering"];

            if (valueUppd == null)
            {
                minuter = 60;
            }
            else
            {
                minuter = int.Parse(valueUppd.ToString());
            }
            /*S**t hämtning från office 365*/
        }
Beispiel #45
0
        public ExperiencePixelSensePage()
        {
            InitializeComponent();
            ExperiencePixelSensePage.Current = this;
            this.PopBottomLegal.SetOpacity(0.0d);
            this.PopLeftLegal.SetOpacity(0.0d);
            this.rBtnBottomPixelSense.PopupChild = PopBottom;
            this.rBtnLeftPixelSense.PopupChild   = PopLeft;

            var timer = new Windows.UI.Xaml.DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };

            timer.Start();
            timer.Tick += (sender, args) =>
            {// well this works? but ew
                timer.Stop();
                rBtnRightPixelSense.PopupChild = FlipViewPage.Current.GetExperiencePixelSensePopup();
                ExperiencePixelSensePopupPage.Current.CloseButton_Clicked += CloseButton_Clicked;
            };

            this.Loaded += ExperiencePixelSensePage_Loaded;
        }
Beispiel #46
0
        public ExperienceDayWorkPage()
        {
            InitializeComponent();
            ExperienceDayWorkPage.Current = this;
            this.LegalBatteryLife.SetOpacity(0.0d);
            this.LegalConnections.SetOpacity(0.0d);
            var timer = new Windows.UI.Xaml.DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };

            timer.Start();
            timer.Tick += (sender, args) =>
            {// well this works? but ew
                timer.Stop();
                this.rBtnTop.PopupChild = FlipViewPage.Current.GetExperienceDayWorkPagePopup();
                ExperienceDayWorkPopupPage.Current.CloseButton_Clicked += CloseButton_Clicked;
            };
            this.LegalBatteryLife.SetOpacity(0);
            this.LegalConnections.SetOpacity(0);
            rBtnLeft.PopupChild  = PopLeft;
            rBtnRight.PopupChild = PopRight;

            this.Loaded += ExperienceDayWorkPage_Loaded;
        }
Beispiel #47
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (recoView.Count() > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    if (mode == 2)
                    {
                        if (recognizer.Name == "Microsoft English (US) Handwriting Recognizer")
                        {
                            inkRecognizerContainer.SetDefaultRecognizer(recognizer);
                        }
                    }
                    if (mode == 1)
                    {
                        if (recognizer.Name == "Microsoft 日本語手書き認識エンジン")
                        {
                            inkRecognizerContainer.SetDefaultRecognizer(recognizer);
                        }
                    }
                }
            }
            Tuple <List <Character>, int, bool> Transfer = e.Parameter as Tuple <List <Character>, int, bool>;

            GanaList  = Transfer.Item1;
            TimeLimit = Transfer.Item2;
            if (Transfer.Item3)
            {
                mode = 2;
            }
            else
            {
                mode = 1;
            }
            if (ClockTimer != null)
            {
                ClockTimer.Stop();
            }
            int multiplier = 0;

            switch (TimeLimit)
            {
            case 1:
                multiplier = 1;
                break;

            case 2:
                multiplier = 2;
                break;

            case 3:
                multiplier = 3;
                break;

            case 4:
                multiplier = 5;
                break;

            case 5:
                multiplier = 10;
                break;

            case 6:
                multiplier = 15;
                break;

            case 7:
                multiplier = 20;
                break;

            case 8:
                multiplier = 25;
                break;

            case 9:
                multiplier = 30;
                break;
            }
            if (TimeLimit > 0)
            {
                dtTimeLeftInSeconds = new TimeSpan(0, 0, multiplier * 1 * 60);
            }
            ClockTimer          = new DispatcherTimer();
            ClockTimer.Tick    += updateClock;
            ClockTimer.Interval = new TimeSpan(0, 0, 1);
            ClockTimer.Start();

            NextCharacter();
        }
        // QueueImage
        // Called to create an image object for the displayed images.

        private async System.Threading.Tasks.Task <Image> QueueImage(int num, bool isFirstImage)
        {
            // Create the image element for the specified image index and add to the
            // slide show div.

            Image image = new Image();

            image.Width             = isFirstImage ? imageSize : thumbnailSize;
            image.Name              = "image" + num;
            image.VerticalAlignment = VerticalAlignment.Bottom;
            var fileContents = await imageList[num % imageList.Count].OpenReadAsync();
            var imageBitmap  = new Windows.UI.Xaml.Media.Imaging.BitmapImage();

            imageBitmap.SetSource(fileContents);
            image.Source = imageBitmap;

            await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                      () =>
            {
                SlideShowPanel.Children.Add(image);
            });

            // If this is the first image of the slide show, queue the next image. Do
            // not queue if streaming as images are already queued before
            // streaming using Play To.

            if (isFirstImage && !streaming)
            {
                var i = await QueueImage(num + 1, false);

                timer          = new Windows.UI.Xaml.DispatcherTimer();
                timer.Interval = new TimeSpan(0, 0, timeLapse);
                timer.Tick    += delegate(object sender, object e)
                {
                    PlayNextImage(num);
                };
                timer.Start();
            }

            // Use the transferred event of the Play To connection for the current image object
            // to "move" to the next image in the slide show. The transferred event occurs
            // when the PlayToSource.playNext() method is called, or when the Play To
            // Receiver selects the next image.

            image.PlayToSource.Connection.Transferred +=
                async delegate(Windows.Media.PlayTo.PlayToConnection sender,
                               Windows.Media.PlayTo.PlayToConnectionTransferredEventArgs e)
            {
                currentImage = num + 1;

                await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                          () =>
                {
                    ((Image)SlideShowPanel.FindName("image" + currentImage)).Width = imageSize;
                });
            };


            // Use the statechanged event to determine which action to take or to respond
            // if the Play To Receiver is disconnected.
            image.PlayToSource.Connection.StateChanged +=
                async delegate(Windows.Media.PlayTo.PlayToConnection sender,
                               Windows.Media.PlayTo.PlayToConnectionStateChangedEventArgs e)
            {
                switch (e.CurrentState)
                {
                case Windows.Media.PlayTo.PlayToConnectionState.Disconnected:

                    // If the state is disconnected and the current image index equals the
                    // num value passed to queueImage, then the image element is not connected
                    // to the Play To Receiver any more. Restart the slide show.
                    // Otherwise, the current image has been discarded and the slide show
                    // has moved to the next image. Clear the current image object and
                    // remove it from the slide show div.

                    if (currentImage == num)
                    {
                        await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                                  async() =>
                        {
                            MessageBlock.Text = "Slideshow disconnected";

                            // Cancel any existing timeout
                            if (timer != null)
                            {
                                timer.Stop();
                            }

                            // Clear all image objects from the slide show div
                            SlideShowPanel.Children.Clear();

                            // Reset the slide show objects and values to their beginning state
                            streaming = false;
                            DisconnectButton.Visibility  = Visibility.Collapsed;
                            InstructionsBlock.Visibility = Visibility.Visible;
                            DisconnectButton.Click      -= DisconnectButtonClick;

                            // Restart the slide show from the current image index
                            var i = await QueueImage(currentImage, true);
                        });
                    }
                    else
                    {
                        await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                                  () =>
                        {
                            image.PlayToSource.Next = null;

                            if (streaming)
                            {
                                SlideShowPanel.Children.Remove(image);
                            }
                        });
                    }

                    break;

                case Windows.Media.PlayTo.PlayToConnectionState.Connected:

                    // If the state is connected and the previous state is disconnected,
                    // then the image element is newly connected. Queue up the next image so
                    // that it is loaded while the current image is being displayed.
                    // If the previous state is rendering, then the user has paused the slideshow
                    // on the Play To Receiver. Clear the current timeout until the user restarts
                    // the slide show.
                    await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              async() =>
                    {
                        if (e.PreviousState == Windows.Media.PlayTo.PlayToConnectionState.Disconnected)
                        {
                            var imageNext           = await QueueImage(num + 1, false);
                            image.PlayToSource.Next = imageNext.PlayToSource;
                        }
                        else if (e.PreviousState == Windows.Media.PlayTo.PlayToConnectionState.Rendering)
                        {
                            if (timer != null)
                            {
                                timer.Stop();
                            }
                        }

                        if (currentImage == num)
                        {
                            MessageBlock.Text = "Slideshow connected";
                        }
                    });

                    break;

                case  Windows.Media.PlayTo.PlayToConnectionState.Rendering:

                    // If the state is rendering and the previous state is
                    // connected, then the Play To Receiver has restarted
                    // the slide show.
                    await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              () =>
                    {
                        if (e.PreviousState == Windows.Media.PlayTo.PlayToConnectionState.Connected)
                        {
                            // Clear any existing timeout.
                            if (timer != null)
                            {
                                timer.Stop();
                            }

                            // Restart the slide show.
                            timer          = new Windows.UI.Xaml.DispatcherTimer();
                            timer.Interval = new TimeSpan(0, 0, timeLapse);
                            timer.Tick    += delegate(object s, object args)
                            {
                                image.PlayToSource.PlayNext();
                            };
                            timer.Start();
                        }

                        if (currentImage == num)
                        {
                            MessageBlock.Text = "Slideshow rendering";
                        }
                    });

                    break;
                }
            };

            return(image);
        }
Beispiel #49
0
        private async void dispatcherTimer_Tick(object sender, object e)
        {
            Nu = System.DateTime.Now.DayOfYear;
            if (Nu > oldDay)
            {
                dispatcherTimer.Stop();
                oldDay          = Nu;
                pring1.IsActive = true;
                var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

                //Konto
                Object valueKonto = localSettings.Values["Konto"];
                if (valueKonto == null)
                {
                    // No data
                }
                else
                {
                    Konto = valueKonto.ToString();
                }
                //Password
                Object valuePwd = localSettings.Values["Password"];
                if (valuePwd == null)
                {
                    // No data
                }
                else
                {
                    Password = valuePwd.ToString();
                }
                //Doman
                Object valueDoman = localSettings.Values["Doman"];
                if (valueDoman == null)
                {
                    // No data
                }
                else
                {
                    Doman = valueDoman.ToString();
                }
                //Konto
                Object valueEpost = localSettings.Values["Epost"];
                if (valueEpost == null)
                {
                    // No data
                }
                else
                {
                    Epost = valueEpost.ToString();
                }
                //Kalender
                Object valueKalender = localSettings.Values["Kalender"];
                if (valueEpost == null)
                {
                    // No data
                }
                else
                {
                    Kalender = valueKalender.ToString();
                }
                //Kalender
                Object valueKalenderNamn = localSettings.Values["KalenderNamn"];
                if (valueEpost == null)
                {
                    // No data
                }
                else
                {
                    KalenderNamn = valueKalenderNamn.ToString();
                }
                DateTime Start = System.DateTime.Now.Date;
                txtInfo.Text = KalenderNamn + ", " + Start.ToString("u").Substring(0, 10);
                var s = await DataSource.GetEvents(Konto, Password, Doman, Epost, Kalender, Start);

                var j    = JsonConvert.DeserializeObject <List <Handelse> >(s);
                var test = j.Where(m => m.Datum == Start.ToString("u").Substring(0, 10));
                EventsList.ItemsSource = test;
                pring1.IsActive        = false;
                dispatcherTimer.Start();
            }
        }
Beispiel #50
0
        private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            dispatcherTimer          = new DispatcherTimer();
            dispatcherTimer.Tick    += dispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 30);
            dispatcherTimer.Start();
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            //Konto
            Object valueKonto = localSettings.Values["Konto"];

            if (valueKonto == null)
            {
                // No data
            }
            else
            {
                Konto = valueKonto.ToString();
            }
            //Password
            Object valuePwd = localSettings.Values["Password"];

            if (valuePwd == null)
            {
                // No data
            }
            else
            {
                Password = valuePwd.ToString();
            }
            //Doman
            Object valueDoman = localSettings.Values["Doman"];

            if (valueDoman == null)
            {
                // No data
            }
            else
            {
                Doman = valueDoman.ToString();
            }
            //Konto
            Object valueEpost = localSettings.Values["Epost"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                Epost = valueEpost.ToString();
            }
            //Kalender
            Object valueKalender = localSettings.Values["Kalender"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                Kalender = valueKalender.ToString();
            }
            //Kalender
            Object valueKalenderNamn = localSettings.Values["KalenderNamn"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                KalenderNamn = valueKalenderNamn.ToString();
            }
            Update();
        }
Beispiel #51
0
        private async void Update()
        {
            //busy.Content = "Uppdaterar kalender i office365";
            ListOfMeeting.Clear();
            busy.IsBusy = true;
            Nu          = System.DateTime.Now.DayOfYear;

            dispatcherTimer.Stop();
            oldDay = Nu;
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            //Konto
            Object valueKonto = localSettings.Values["Konto"];

            if (valueKonto == null)
            {
                // No data
            }
            else
            {
                Konto = valueKonto.ToString();
            }
            //Password
            Object valuePwd = localSettings.Values["Password"];

            if (valuePwd == null)
            {
                // No data
            }
            else
            {
                Password = valuePwd.ToString();
            }
            //Doman
            Object valueDoman = localSettings.Values["Doman"];

            if (valueDoman == null)
            {
                // No data
            }
            else
            {
                Doman = valueDoman.ToString();
            }
            //Konto
            Object valueEpost = localSettings.Values["Epost"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                Epost = valueEpost.ToString();
            }
            //Kalender
            Object valueKalender = localSettings.Values["Kalender"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                Kalender = valueKalender.ToString();
            }
            //Kalender
            Object valueKalenderNamn = localSettings.Values["KalenderNamn"];

            if (valueEpost == null)
            {
                // No data
            }
            else
            {
                KalenderNamn = valueKalenderNamn.ToString();
            }
            DateTime dCalcDate = DateTime.Now;
            DateTime Start     = new DateTime(dCalcDate.Year, dCalcDate.Month, 1);
            //txtInfo.Text = KalenderNamn + ", " + Start.ToString("u").Substring(0, 10);
            var s = await DataSource.GetEvents(Konto, Password, Doman, Epost, Kalender, Start);

            var j    = JsonConvert.DeserializeObject <List <Handelse> >(s);
            var test = j.Where(m => m.Datum == Start.ToString("u").Substring(0, 10));

            foreach (var H in j)
            {
                Meeting  meeting = new Meeting();
                string[] tid     = H.Start.Split(':');
                string   sZon    = H.Tzon.Substring(5, 2);
                int      iZon    = int.Parse(sZon);
                int      timme   = int.Parse(tid[0]);
                int      minut   = int.Parse(tid[1]);
                int      ar      = int.Parse(H.Datum.Substring(0, 4));
                meeting.From      = new DateTime(ar, H.Manad, H.Dag, timme + iZon, minut, 0);
                tid               = H.S**t.Split(':');
                timme             = int.Parse(tid[0]);
                minut             = int.Parse(tid[1]);
                meeting.To        = new DateTime(ar, H.Manad, H.Dag, timme + iZon, minut, 0);
                meeting.EventName = H.Amne;
                if (meeting.From < dCalcDate && meeting.To > dCalcDate)
                {
                    SolidColorBrush NowBrush = new SolidColorBrush(Windows.UI.Colors.Red);
                    meeting.color = NowBrush;
                }
                else
                {
                    SolidColorBrush ElseBrush = new SolidColorBrush(Windows.UI.Colors.Green);
                    meeting.color = ElseBrush;
                }
                ListOfMeeting.Add(meeting);
            }
            KalDag.ItemsSource = null;
            KalDag.ItemsSource = ListOfMeeting;
            dispatcherTimer.Start();
            busy.IsBusy = false;
        }