Inheritance: IDispatcherTimer
 public MainPage()
 {
     InitializeComponent();
     DispatcherTimer timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
     timer.Tick += Timer_Tick;
     timer.Start();
 }
        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;
        }
        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;
        }
        // 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();
        }
 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();
 }
 private void InitTimer()
 {
     timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Interval = TimeSpan.FromMilliseconds(1000);
     timer.Start();
 }
示例#7
0
        public MainPage()
        {
            InitializeComponent();
            Unloaded += MainPage_Unloaded;

            //Window.Current.CoreWindow.PointerCursor = null;

            connection = new RemoteConnection();
            connection.OnLedEvent(LedEvent);

            led = new MulticolorLed(redPinNumber: 18, greenPinNumber: 23, bluePinNumber: 24);
            humitureSensor = new Dht11HumitureSensor(pinNumber: 4);
            relay = new Relay(pinNumber: 16);

            motionDetector = new Sr501PirMotionDetector(pinNumber: 12);
            motionDetector.RaiseEventsOnUIThread = true;
            motionDetector.MotionDetected += MotionDetector_MotionDetected;
            motionDetector.MotionStopped += MotionDetector_MotionStopped;

            flameSensor = new FlameSensor(pinNumber: 27);
            flameSensor.RaiseEventsOnUIThread = true;
            flameSensor.FlameDetected += FlameSensor_FlameDetected;
            flameSensor.FlameExtinguished += FlameSensor_FlameExtinguished;

            timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
            timer.Tick += Timer_Tick;
        }
        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;
            }
        }
示例#9
0
 public CalibrationBar()
 {
     this.InitializeComponent();
     _calibrationTimer = new DispatcherTimer();
     _calibrationTimer.Tick += OnAutoDismissTimerExpired;
     _calibrationTimer.Interval = CALIBRATION_POPUP_AUTO_DIMSMISS_TIME;
 }
 public void onLoad(object o, RoutedEventArgs e)
 {
     DispatcherTimer tmr = new DispatcherTimer();
     tmr.Interval = TimeSpan.FromSeconds(1);
     tmr.Tick += Draw;
     tmr.Start();
 }
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Frame> e)
    {
      base.OnElementChanged(e);
      if (Element == null)
        return;

      player = new MediaElement();
      player.AutoPlay = true;
      player.MediaOpened += (sender, args) =>
      {

        timer.Start();

      };
      this.Control.Child = player;

      timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) };
      timer.Tick += timer_Tick;

      if (string.IsNullOrWhiteSpace(Player.Url))
        return;

      InitPlayer();
      
    }
示例#12
0
 public void DispatcherTimerSetup()
 {
     dispatcherTimer = new DispatcherTimer();
     dispatcherTimer.Tick += dispatcherTimer_Tick;
     dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
     dispatcherTimer.Start();
 }
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Tick += Timer_Tick;
     timer.Stop();
 }
示例#14
0
 public InkToTextBox()
 {
     this.DefaultStyleKey = typeof(InkToTextBox);
     timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Interval = TimeSpan.FromSeconds(3);
 }
        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;
        }
        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()
 {
     weathertimer = new DispatcherTimer();
     weathertimer.Interval = TimeSpan.FromHours(1); 
     weathertimer.Tick += Timer_Tick;
     weathertimer.Start();
 }
示例#18
0
 public Render()
 {
     InitializeComponent();
     Loaded += Render_Loaded;
     timer = new DispatcherTimer();
     frameIndex = 0;
 }
        /// <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;
            }
        }
示例#20
0
 public void init()
 {
     DispatcherTimer tmr = new DispatcherTimer();
     tmr.Interval = TimeSpan.FromSeconds(1);
     tmr.Tick += Draw;
     tmr.Start();
 }
示例#21
0
        // *** 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();
            }
        }
示例#22
0
        public PlayerViewModel(
            AudioPlayerHelper helper,
            ICollectionService service,
            IAppSettingsHelper appSettingsHelper)
        {
            _helper = helper;
            _service = service;
            _appSettingsHelper = appSettingsHelper;

            if (!IsInDesignMode)
            {
                helper.TrackChanged += HelperOnTrackChanged;
                helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
                helper.Shutdown += HelperOnShutdown;

                _nextRelayCommand = new RelayCommand(NextSong);
                _prevRelayCommand = new RelayCommand(PrevSong);
                _playPauseRelayCommand = new RelayCommand(PlayPauseToggle);

                _timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
                _timer.Tick += TimerOnTick;
            }
            else
            {
                CurrentQueue = service.PlaybackQueue.FirstOrDefault();
                PlayPauseIcon = Symbol.Play;
            }
        }
示例#23
0
        public HomePage()
        {
            this.InitializeComponent();

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            //StatusField.Text = "Please ensure the sensor is connected";

            app = App.Current as SensorTagReader.App;

            if (app.HorseName != null) HorseNameField.Text = app.HorseName;
            if (app.SessionID != null)
                SesssionIDField.Text = app.SessionID;
            else
                SesssionIDField.Text = _sessionID;


            tagReaders = new List<TagReaderService>();
            deviceInfoService = new DeviceInfoService();

            eventHubWriterTimer = new DispatcherTimer();
            eventHubWriterTimer.Interval = new TimeSpan(0, 0, 1);
            eventHubWriterTimer.Tick += OnEventHubWriterTimerTick;

        }
示例#24
0
 private void CheckDataLoaded()
 {
     this._timer = new DispatcherTimer();
     this._timer.Tick += timer_Tick;
     this._timer.Interval = new TimeSpan(0, 0, 1);
     this._timer.Start();
 }
示例#25
0
        public MainPage()
        {
            this.InitializeComponent();
            vis     = new VisualEffect(forwardBut, backwardBut, page0, lightsensrate, microsensrate, THsensrate, fortostage2, fortostage3, backtostage1, backtostage2, conimage, usernamebox, passbox, senbox, calmes, pre, forw, logbox, page1, radChart);
            handler = new GUIDATAHANDLER(vis);

            //Sample Entry
            lightrate_sample.Add("0.5 sec");
            lightrate_sample.Add("1 sec");
            lightrate_sample.Add("1.5 sec");
            lightrate_sample.Add("2 sec");

            microphonerate_sample.Add("33 Hz");
            microphonerate_sample.Add("50 Hz");
            microphonerate_sample.Add("100 Hz");
            microphonerate_sample.Add("200 Hz");

            thrate_sample.Add("1 sec");
            thrate_sample.Add("2 sec");
            thrate_sample.Add("3 sec");



            //use this code
            handler.setLightSensRateValues(lightrate_sample);
            handler.setMicrophoneSensRateValues(microphonerate_sample);
            handler.setTHSensRateValues(thrate_sample);

            _timer_1       = new Windows.UI.Xaml.DispatcherTimer();
            _timer_1.Tick += LightSensorRead;
            _timer_2       = new Windows.UI.Xaml.DispatcherTimer();
            _timer_2.Tick += SoundSensorRead;
            _timer_3       = new Windows.UI.Xaml.DispatcherTimer();
            _timer_3.Tick += THSensorRead;
        }
 public NotificationStatusControl()
 {
     this.InitializeComponent();
     (Resources["rotateAnimetion"] as Storyboard).Begin();
     VisualStateManager.GoToState(this, "StateNotConnection", true);
     State = NotificationState.NotConnection;
     notificationTimer = new DispatcherTimer();
     notificationTimer.Tick += (s, e) =>
     {
         switch (BeforeState)
         {
             case NotificationState.Connection:
                 VisualStateManager.GoToState(this, "StateConnection", true);
                 State = NotificationState.Connection;
                 break;
             case NotificationState.NotConnection:
                 VisualStateManager.GoToState(this, "StateNotConnection", true);
                 State = NotificationState.NotConnection;
                 break;
             case NotificationState.Notification:
                 VisualStateManager.GoToState(this, "StateNotification", true);
                 State = NotificationState.Notification;
                 break;
         }
         notificationTimer.Stop();
     };
 }
示例#27
0
 public MainPage()
 {
     this.InitializeComponent();
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Tick += Timer_Tick;
 }
 public MainPage() {
     this.InitializeComponent();
     m_timer = new DispatcherTimer();
     m_timer.Interval = TimeSpan.FromMilliseconds(500); //100, 500
     m_timer.Tick += dispatcher_timer_Tick; ;
     InitSPIAndTimer();
 }
示例#29
0
    public SplitPage()
    {
      this.InitializeComponent();

      // Setup the navigation helper
      this.navigationHelper = new NavigationHelper(this);
      this.navigationHelper.LoadState += navigationHelper_LoadState;
      this.navigationHelper.SaveState += navigationHelper_SaveState;

      // Setup the logical page navigation components that allow
      // the page to only show one pane at a time.
      this.navigationHelper.GoBackCommand = new DNR.Win.Common.RelayCommand(() => this.GoBack(), () => this.CanGoBack());
      this.itemListView.SelectionChanged += itemListView_SelectionChanged;

      // Start listening for Window size changes 
      // to change from showing two panes to showing a single pane
      Window.Current.SizeChanged += Window_SizeChanged;
      this.InvalidateVisualState();

      itemDetailTitlePanel.Visibility = Visibility.Collapsed;
      timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) };
      timer.Tick += UpdateTimeDisplay;

      //detect if the user is touching the slider or not.
      Window.Current.CoreWindow.PointerPressed += (e, a) => { isPressed = true; newValue = -1; };
      Window.Current.CoreWindow.PointerReleased += (e, a) =>
      {
        isPressed = false;

        if (!initialized)
          return;
        if (newValue >= 0)
          player.Position = new TimeSpan(0, 0, (int)((newValue / 100) * player.NaturalDuration.TimeSpan.TotalSeconds));
      };
    }
示例#30
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 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();
        }
示例#32
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 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;
            };
        }
        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();
        }
示例#35
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;
        }
示例#36
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);
                }
            }
        }
示例#37
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();
        }
        public MainPage()
        {
            this.InitializeComponent();

            Timer          = new DispatcherTimer();
            Timer.Tick    += Timer_Tick;
            Timer.Interval = new System.TimeSpan(0, 0, 0, 0, 250);

            sender = new System.Net.Http.HttpClient();

            // Cache the UI to have the checkboxes retain their state, as the enabled/disabled state of the
            // GetPreviewFrameButton is reset in code when suspending/navigating (see Start/StopPreviewAsync)
            NavigationCacheMode = NavigationCacheMode.Required;

            // Useful to know when to initialize/clean up the camera
            Application.Current.Suspending += Application_Suspending;
            Application.Current.Resuming   += Application_Resuming;
        }
示例#39
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;
        }
示例#40
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;
        }
示例#41
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*/
        }
示例#42
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;
        }
示例#43
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;
        }
示例#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, 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();
        }
        // 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);
        }
示例#46
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();
        }