// 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 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(); } }
/// <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(); }
// *** 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(); } }
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); }
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(); }; }
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(); } }
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; }
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(); }
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(); }
void Activate() { // this delay allows the ext splash image to load and render var _Timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(1000) }; _Timer.Tick += (s, e) => { _Timer.Stop(); Window.Current.Activate(); }; _Timer.Start(); }
private void InitButtonTimer() { if (_buttonTimer != null) return; _buttonTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(2000)}; _buttonTimer.Tick += (sender, e) => { _buttonTimer.Stop(); _lastButtonId = string.Empty; }; }
internal ThrottleTimer(int milliseconds, Action handler) { Action = handler; throttleTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds((double)milliseconds) }; throttleTimer.Tick += delegate(object s, object e) { if (Action != null) { Action.Invoke(); } throttleTimer.Stop(); }; }
private void MakeMoveIfCorrectTurn() { if (_viewModel.NextMove == _computerColor) { // make a move after a short delay. var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(0.5); timer.Tick += (s, e2) => { MakeNextMove(); timer.Stop(); }; timer.Start(); } }
/// <summary> /// <para>Executes the user code after a specified duration.</para> /// <para>Note: This method produces a working EventToken</para> /// </summary> /// <param name="duration"></param> /// <param name="timeType"></param> /// <returns>A token representing the animation</returns> public override EventToken After(double duration, OrSo timeType) { DispatcherTimer timer = new DispatcherTimer(); EventToken placeholder = EventToken.PlaceholderToken(); timer.Interval = GetTimeSpan(duration, timeType); timer.Tick += (s, e) => { timer.Stop(); placeholder.PassOn(Now()); }; timer.Start(); return placeholder; }
private void backwardBut_Click(object sender, RoutedEventArgs e) { int res = vis.BKpressed(); if (res == 0) { CloseApp(); } else { _timer_1.Stop(); _timer_2.Stop(); _timer_3.Stop(); vis.setHome(); } }
/// <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); } } }
public Shell() : base() { this.ViewModel = new ShellViewModel(); loadingTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(600) }; loadingTimer.Tick += ((sender, e) => { loadingTimer.Stop(); loadingProgressRing.IsActive = false; extendedLoadingHome.Visibility = Windows.UI.Xaml.Visibility.Collapsed; }); this.InitializeComponent(); var applicationView = ApplicationView.GetForCurrentView(); this.Loaded += MainPage_Loaded; FullScreenService.FullScreenModeChanged += ((sender, e) => { isFullScreen = e; }); }
private void InitControls() { if (mainGrid == null) { mainGrid = (Grid)GetTemplateChild("mainGrid"); spChildren = (StackPanel)GetTemplateChild("spChildren"); Render(); DispatcherTimer dtOnce = new DispatcherTimer(); dtOnce.Interval = TimeSpan.FromSeconds(1.5); dtOnce.Tick += (o, e) => { ShowMandatory(); dtOnce.Stop(); }; dtOnce.Start(); } }
public SplashScreenPage() { InitializeComponent(); _navigationHelper = new NavigationHelper(this); _navigationHelper.LoadState += NavigationHelper_LoadState; _navigationHelper.SaveState += NavigationHelper_SaveState; // Login on Gitter API using Timer var dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) }; dispatcherTimer.Tick += async (sender, o) => { dispatcherTimer.Stop(); await ViewModelLocator.Login.LoginAsync(); }; dispatcherTimer.Start(); }
public void Tick(DispatcherTimer timer) { if (Player.IsAlive) { Player.Tick(Board); Board.Tick(); // Update timer-interval (based on Level) Level = (Player.Length / 2); timer.Interval = TimeSpan.FromMilliseconds(1000 - (Level * 100)); } else { timer.Stop(); // Board.ResetLEDGameOver(); } }
public void navigateToIndstil() { DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new System.TimeSpan(0, 0, 0, 0, 100); timer.Tick += (object sender, object e) => { if (flag) { flag = false; timer.Stop(); game.Exit(); Window.Current.Content = _indstil; Window.Current.Activate(); } }; timer.Start(); flag = true; }
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; }
private static void OnBottomChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Shape shape = d as Shape; if (shape == null) { return; } var timer = new DispatcherTimer(); timer.Tick += (obj, args) => { var parent = shape.Parent as Canvas; timer.Stop(); var top = parent.ActualHeight - double.Parse(e.NewValue.ToString()) - shape.Height; Canvas.SetTop(shape, top); }; timer.Interval = TimeSpan.FromMilliseconds(100); timer.Start(); }
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; }
public static void Init(SqliteDatabase db) { if (db == null) return; if (_isInitialized) return; _dtSave = new DispatcherTimer(); _dtSave.Interval = TimeSpan.FromSeconds(60); //attempt _dtSave.Tick += (o, a) => { _dtSave.Stop(); if (!_db.SqliteDb.IsInTransaction) { PersistLoggingInformation(); } _dtSave.Start(); }; _db = db; _db.SqliteDb.CreateTable<LogMessage>(); _isInitialized = true; }
private void TryRegisterUser() { if (timer != null) { return; } TimeView.Value = 30; // Start timer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 1); timer.Tick += (sender, evt) => { int value = (int)TimeView.Value; value = Math.Max(0, value - 1); TimeView.Value = value; if (value == 0 && timer != null) { timer.Stop(); timer = null; ShowTimeoutDialogAsync(); } else { // Try to call the registration API every several seconds if (value % 3 == 0) { TryRegisterUserAsync(); } } }; timer.Start(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); CommonData.activeConversationPage = this; DataStorage.ApplicationRunning = true; actionEnabled = true; session = CommonData.session; if (session == null) this.Frame.GoBack(); signatureSecret = null; shiftDown = false; await CommonData.LoadStoredMessagesAsync(); messageListItems = new ObservableCollection<MessageListItem>(); conversationListItems = new ObservableCollection<ConversationListItem>(); conversationsList.DataContext = conversationListItems; display.DataContext = messageListItems; unreadIndicator.Foreground = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); blinkerTimer = new DispatcherTimer(); blinkerTimer.Interval = TimeSpan.FromMilliseconds(500); blinkerTimer.Tick += blinkUnreadIndicator; blinkerTimer.Stop(); await refreshConversationList(); foreach (var credential in DataStorage.GetNotifierCredentials()) { if (credential[0] == session.Username) { toggleNotificationsSwitch.IsOn = true; break; } } if (conversationListItems.Count == 0) startNewConversation(); else selectPeer(conversationListItems[0].Name); if (e.NavigationMode == NavigationMode.Forward || e.NavigationMode == NavigationMode.New) { await refreshMessages(); } closeSideMenu(); }
private void TwoFactorGrid_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { if (PopupCodeCopied.IsOpen) { PopupCodeCopied.IsOpen = false; } if (TwoFactorGrid.Items.Count > 0 && e.OriginalSource.GetType() != typeof(Grid) && TwoFactorGrid.SelectionMode == ListViewSelectionMode.None) { var bounds = GetElementBounds(MainCommandBar, MainGrid); PopupCodeCopied.VerticalOffset = bounds.Top - 50; PopupCodeCopied.HorizontalOffset = bounds.Left + PopupCodeCopied.ActualWidth / 4; PopupCodeCopied.IsOpen = true; DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(3) }; timer.Tick += delegate (object tsender, object te) { PopupCodeCopied.IsOpen = false; timer.Stop(); }; timer.Start(); } }
private void ShowAddAccountHint() { if (TwoFactorGrid.Items.Count == 0) { DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(3) }; timer.Tick += delegate (object sender, object e) { timer.Stop(); if (AddAccountButton.Visibility == Visibility.Visible) { var bounds1 = GetElementBounds(AddAccountButton, MainCommandBar); var bounds2 = GetElementBounds(MainCommandBar, MainGrid); PopupHints.VerticalOffset = bounds2.Top - 38; PopupHints.HorizontalOffset = bounds1.Left + bounds1.Width / 2 - 80; if (TwoFactorGrid.Items.Count == 0) PopupHints.IsOpen = true; } }; timer.Start(); } }
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; }
/// <summary> /// Updates Timer UI based on Tick Events /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timer_Tick(object sender, object e) { int time; int timeSoFar; switch (stateOfTimer) { // prep case case 0: state.Text = "Prep"; time = timerObject.PrepTime; int.TryParse(counter.Text, out timeSoFar); //int progress = timeSoFar / time; //timerProgress. = progress; if (timeSoFar != time) { timeSoFar += 1; counter.Text = "" + timeSoFar; } else { counter.Text = "00"; stateOfTimer++; } break; //Work Case case 1: time = timerObject.RoundDuration; if (currentRound < timerObject.Rounds) { state.Text = "Work"; timerProgress.IsActive = true; int.TryParse(counter.Text, out timeSoFar); if (timeSoFar != time) { timeSoFar += 1; counter.Text = "" + timeSoFar; } else { currentRound++; counter.Text = "00"; stateOfTimer++; } } else { stateOfTimer = 3; } break; //Rest Case case 2: state.Text = "Rest"; time = timerObject.Rest; timerProgress.IsActive = false; int.TryParse(counter.Text, out timeSoFar); if (timeSoFar != time) { timeSoFar += 1; counter.Text = "" + timeSoFar; } else { counter.Text = "00"; stateOfTimer--; } break; //final case Cool down case 3: timerProgress.IsActive = false; state.Text = "Cool Down"; time = timerObject.CoolDown; int.TryParse(counter.Text, out timeSoFar); if (timeSoFar != time) { timeSoFar += 1; counter.Text = "" + timeSoFar; } else { counter.Text = "00"; timer.Stop(); reset(); } break; } }
public NotificationView(string msg, string title, bool autoHide, double timeToLive, string metroIcon = "", string imageIcon = "", double scaleIcon = 1.0) { this.InitializeComponent(); lblTitle.Text = title; lblMessage.Text = msg; ((DoubleAnimation)sbCountdown.Children[0]).Duration = new Duration(TimeSpan.FromSeconds(timeToLive)); if (imageIcon != string.Empty) LoadImage(imageIcon); else LoadMetroIcon(metroIcon, iconColor:null, scaleIcon: scaleIcon); dtClose = new DispatcherTimer(); dtClose.Interval = TimeSpan.FromSeconds(timeToLive); dtClose.Tick += (o, e) => { //sbCountdown.Stop(); dtClose.Stop(); this.Hide(); }; dtClose.Start(); }
private async Task TimeTrading(string id) { var svItems = await Timeloader.GetStockItems(id); if (svItems == null || svItems.Prices == null || svItems.Volumns == null) { Debug.WriteLine("Can not load candle items"); return; } var idAverage = id + "average"; var cItems = await Timeloader.GetChartItems(idAverage); var maCollection = CreateTimeMACollection(cItems, idAverage); tradingTimer = new DispatcherTimer(); int i = 0; tradingTimer.Interval = tradingPeriod; tradingTimer.Tick += (s, e) => { if (i == svItems.Prices.Count) { tradingTimer.Stop(); return; } price.MainCollection.AddLatestChartItem(svItems.Prices[i]); price.AssistCollections.First().AddLatestChartItem(cItems[i]); volumn.MainCollection.AddLatestChartItem(svItems.Volumns[i]); price.ForceDraw(false, false); i++; }; tradingTimer.Start(); }
private void CandleTrading(string id, ChartItemCollection priceColl, ChartItemCollection volumnColl, IEnumerable<ChartItemCollection> maColls, StockVolumnList svList, int mvStart = 0) { tradingTimer = new DispatcherTimer(); bool isStarted = false; int i = 0; tradingTimer.Interval = tradingPeriod; tradingTimer.Tick += async (s, e) => { var tvList = await Timeloader.GetStockItems(id); if (i == tvList.Prices.Count) { tradingTimer.Stop(); return; } var candle = tvList.Prices[i]; var volumn = tvList.Volumns[i]; if (!isStarted) { priceColl.AddLatestChartItem(candle); volumnColl.AddLatestChartItem(volumn); UpdateMACollections(maColls, svList.Prices, candle, mvStart, isStarted); isStarted = true; } else { var lastestCandle = priceColl.Items.Last() as StockItem; var lastestVolumn = volumnColl.Items.Last() as VolumnItem; candle = MergeChartItem(lastestCandle, candle); volumn = MergeChartItem(lastestVolumn, volumn); volumn.IsRaise = candle.Open <= candle.Close; priceColl.UpdateLatestChartItem(candle); volumnColl.UpdateLatestChartItem(volumn); UpdateMACollections(maColls, svList.Prices, candle, mvStart, isStarted); } price.ForceDraw(false, false); i++; }; tradingTimer.Start(); }
public void Tick(DispatcherTimer timer) { if (!PlayAnimationFrame()) { timer.Stop(); } }
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { try { var toast = (Toastinet)d; if (e.NewValue == null || String.IsNullOrEmpty(e.NewValue.ToString()) || (e.OldValue != null && toast.Queued && toast._queue.Contains(e.OldValue.ToString()))) { if (e.NewValue == null || String.IsNullOrEmpty(e.NewValue.ToString())) if (toast.Queued && toast._queue.Any()) { toast.Message = toast._queue.Dequeue(); } return; } if (e.OldValue != null && toast.Queued && !toast.GetCurrentState(toast.GetValidAnimation() + "Group").Name.Contains("Closed")) { toast._queue.Enqueue(e.NewValue.ToString()); toast.Message = e.OldValue.ToString(); return; } VisualStateManager.GoToState(toast, toast.GetValidAnimation() + "Opened", true); var timer = new DispatcherTimer { Interval = toast._interval }; timer.Tick += (s, t) => { VisualStateManager.GoToState(toast, toast.GetValidAnimation() + "Closed", true); timer.Stop(); }; timer.Start(); } catch (Exception ex) { Debug.WriteLine("Exception occured during OnTextChanged operation. Details: " + ex.Message); } }
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; }
public Keyboard() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; //keyboard Loaded += delegate { // access ActualWidth and ActualHeight here double ActualWidth = NoteButton2.ActualWidth * 0.5; double BlackKeysWidth = NoteButton2.ActualWidth * 0.8; NoteButtonB1.Width = BlackKeysWidth; NoteButtonB2.Width = BlackKeysWidth; NoteButtonB3.Width = BlackKeysWidth; NoteButtonB4.Width = BlackKeysWidth; NoteButtonB5.Width = BlackKeysWidth; NoteButtonB6.Width = BlackKeysWidth; NoteButtonB7.Width = BlackKeysWidth; NoteButtonB8.Width = BlackKeysWidth; NoteButtonB9.Width = BlackKeysWidth; NoteButtonB10.Width = BlackKeysWidth; blackKeys.Margin = new Thickness(ActualWidth, 0, -ActualWidth, 0); }; layerName.GotFocus += (sender, ee) => { layerName.Text = ""; }; if (SharedInformations.isInstTry) { PlayStopButton.Visibility = Visibility.Collapsed; RecordButton.Visibility = Visibility.Collapsed; SaveLayerButton.Visibility = Visibility.Collapsed; cmdBar.Visibility = Visibility.Collapsed; LayerProgressTime.Visibility = Visibility.Collapsed; pageTitle.Text = SharedInformations.SelectedInstrument.Title; } else { layer = new ItemLayer(SharedInformations.SelectedProject.Title, layerName.Text, "/Assets/Instruments/Wide/" + SharedInformations.SelectedInstrument.Title.ToLower() + ".png", true, new List<RecordedNote>(), SharedInformations.SelectedInstrument.Title, 4); pageTitle.Text = "Keyboard"; LayerProgressTime.Maximum = layerTimeLengthInMilliSeconds = GetLayerTimeLengthInMilliSeconds(); playTimer = new DispatcherTimer(); playTimer.Interval = TimeSpan.FromMilliseconds(30); playTimer.Tick += (sen, ev) => { var notes = layer.recordedNotes.Where(n => n.time >= playTime && n.time < playTime + 30); foreach (RecordedNote recordedNote in notes) { MusicReader.PlayNote(recordedNote.note); } //if the cursor exceeds the length of the whole track if (playTime >= layerTimeLengthInMilliSeconds) { //the cursor returns to the start of the track (-30 and increases with 30 = 0) to replay it playTime = -30; } //increasing the cursor with 30 ms playTime += 30; //updating the value of the progress bar LayerProgressTime.Value = playTime; }; recordTimer = new DispatcherTimer(); recordTimer.Interval = TimeSpan.FromMilliseconds(30); recordTimer.Tick += (sen, ev) => { if (recordTime >= layerTimeLengthInMilliSeconds) { recording = false; recordTimer.Stop(); recordTime = 0; LayerProgressTime.Value = 0; } recordTime += 30; LayerProgressTime.Value = recordTime; }; layer.recordedNotes = new List<RecordedNote>(); LayerProgressTime.Visibility = Visibility.Visible; PlayStopButton.Visibility = Visibility.Visible; RecordButton.Visibility = Visibility.Visible; SaveLayerButton.Visibility = Visibility.Visible; cmdBar.Visibility = Visibility.Visible; } if (SharedInformations.SelectedInstrument.Title.Equals("Drums") || SharedInformations.SelectedInstrument.Title.Equals("Darbuka")) { mpc.Visibility = Visibility.Visible; pianoKeys.Visibility = Visibility.Collapsed; blackKeys.Visibility = Visibility.Collapsed; notes = new Dictionary<String, String>(); notes.Add("mpc1", "Assets/" + SharedInformations.SelectedInstrument.Title + "1.wav"); notes.Add("mpc2", "Assets/" + SharedInformations.SelectedInstrument.Title + "2.wav"); notes.Add("mpc3", "Assets/" + SharedInformations.SelectedInstrument.Title + "3.wav"); notes.Add("mpc4", "Assets/" + SharedInformations.SelectedInstrument.Title + "4.wav"); notes.Add("mpc5", "Assets/" + SharedInformations.SelectedInstrument.Title + "5.wav"); notes.Add("mpc6", "Assets/" + SharedInformations.SelectedInstrument.Title + "6.wav"); notes.Add("mpc7", "Assets/" + SharedInformations.SelectedInstrument.Title + "7.wav"); notes.Add("mpc8", "Assets/" + SharedInformations.SelectedInstrument.Title + "8.wav"); MusicReader.FillNotes(SharedInformations.SelectedInstrument.Title, false); } else { mpc.Visibility = Visibility.Collapsed; pianoKeys.Visibility = Visibility.Visible; blackKeys.Visibility = Visibility.Visible; notes = new Dictionary<String, String>(); notes.Add("NoteButton1", "Assets/" + SharedInformations.SelectedInstrument.Title + "1.wav"); notes.Add("NoteButton2", "Assets/" + SharedInformations.SelectedInstrument.Title + "2.wav"); notes.Add("NoteButton3", "Assets/" + SharedInformations.SelectedInstrument.Title + "3.wav"); notes.Add("NoteButton4", "Assets/" + SharedInformations.SelectedInstrument.Title + "4.wav"); notes.Add("NoteButton5", "Assets/" + SharedInformations.SelectedInstrument.Title + "5.wav"); notes.Add("NoteButton6", "Assets/" + SharedInformations.SelectedInstrument.Title + "6.wav"); notes.Add("NoteButton7", "Assets/" + SharedInformations.SelectedInstrument.Title + "7.wav"); notes.Add("NoteButton8", "Assets/" + SharedInformations.SelectedInstrument.Title + "8.wav"); notes.Add("NoteButton9", "Assets/" + SharedInformations.SelectedInstrument.Title + "9.wav"); notes.Add("NoteButton10", "Assets/" + SharedInformations.SelectedInstrument.Title + "10.wav"); notes.Add("NoteButton11", "Assets/" + SharedInformations.SelectedInstrument.Title + "11.wav"); notes.Add("NoteButton12", "Assets/" + SharedInformations.SelectedInstrument.Title + "12.wav"); notes.Add("NoteButton13", "Assets/" + SharedInformations.SelectedInstrument.Title + "13.wav"); notes.Add("NoteButton14", "Assets/" + SharedInformations.SelectedInstrument.Title + "14.wav"); notes.Add("NoteButtonB1", "Assets/" + SharedInformations.SelectedInstrument.Title + "_1.wav"); notes.Add("NoteButtonB2", "Assets/" + SharedInformations.SelectedInstrument.Title + "_2.wav"); notes.Add("NoteButtonB3", "Assets/" + SharedInformations.SelectedInstrument.Title + "_3.wav"); notes.Add("NoteButtonB4", "Assets/" + SharedInformations.SelectedInstrument.Title + "_4.wav"); notes.Add("NoteButtonB5", "Assets/" + SharedInformations.SelectedInstrument.Title + "_5.wav"); notes.Add("NoteButtonB6", "Assets/" + SharedInformations.SelectedInstrument.Title + "_6.wav"); notes.Add("NoteButtonB7", "Assets/" + SharedInformations.SelectedInstrument.Title + "_7.wav"); notes.Add("NoteButtonB8", "Assets/" + SharedInformations.SelectedInstrument.Title + "_8.wav"); notes.Add("NoteButtonB9", "Assets/" + SharedInformations.SelectedInstrument.Title + "_9.wav"); notes.Add("NoteButtonB10", "Assets/" + SharedInformations.SelectedInstrument.Title + "_10.wav"); MusicReader.FillNotes(SharedInformations.SelectedInstrument.Title, true); } //Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown; //Window.Current.CoreWindow.KeyUp += CoreWindow_KeyUp; }
private void hideMenu() { moreDisplayed = false; animationCounter = 0; ButtonMove.Y += 4; TabMove.Y += 1; DispatcherTimer dt = new DispatcherTimer(); dt.Interval = new TimeSpan(0, 0, 0, 0, 1); // 500 Milliseconds dt.Tick += delegate { if (animationCounter >= 180) dt.Stop(); ButtonMove.Y += 30; TabMove.Y += 30; animationCounter += 30; }; dt.Start(); }
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(); }
public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; Steps = new List<Step> { new Step{}, new Step{MusicUrl="ms-appx:///Assets/a6w/get ready.mp3"}, new Step{}, new Step{MusicUrl="ms-appx:///Assets/a6w/5.mp3"}, new Step{MusicUrl="ms-appx:///Assets/a6w/4.mp3"}, new Step{MusicUrl="ms-appx:///Assets/a6w/3.mp3"}, new Step{MusicUrl="ms-appx:///Assets/a6w/2.mp3"}, new Step{MusicUrl="ms-appx:///Assets/a6w/1.mp3"}, new Step{MusicUrl="ms-appx:///Assets/a6w/go.mp3"}, #region //// exercise 1 new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex1.mp3",Cycle = "1/6",BaiTap = "1"}, new Step{}, new Step{TimeDo = "0", Cycle = "1/6",MusicUrl="ms-appx:///Assets/a6w/up.mp3",BaiTap="1"}, new Step{TimeDo = "3",Image="Assets/a6w/1_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/1_2.png",Cycle = "2/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/1_1.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/1_2.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/1_1.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/1_2.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, #endregion #region //// exercise 2 new Step{TimeDo = "0"}, new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex2.mp3",Cycle = "1/6",BaiTap = "2"}, new Step{}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "1/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "2/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "3/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "4/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "5/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/2_1.png",Cycle = "6/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, #endregion #region //// exercise 3 new Step{TimeDo = "0"}, new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex3.mp3",Cycle = "1/6",BaiTap = "3"}, new Step{}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "1/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_2.png",Cycle = "2/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_1.png",Cycle = "3/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_2.png",Cycle = "4/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_1.png",Cycle = "5/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/3_2.png",Cycle = "6/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, #endregion #region //// exercise 4 new Step{TimeDo = "0"}, new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex4.mp3",Cycle = "1/6",BaiTap = "4"}, new Step{}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "1/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "2/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "3/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "4/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "5/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/4_1.png",Cycle = "6/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, #endregion #region //// exercise 5 new Step{TimeDo = "0"}, new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex5.mp3",Cycle = "1/6",BaiTap = "5"}, new Step{}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/5_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/5_2.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/switch.mp3"}, new Step{TimeDo = "3", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/5_1.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/switch.mp3"}, new Step{TimeDo = "3", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/5_2.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/switch.mp3"}, new Step{TimeDo = "3", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/5_1.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/switch.mp3"}, new Step{TimeDo = "3", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/5_2.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/switch.mp3"}, new Step{TimeDo = "3", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, #endregion #region //// exercise 6 new Step{TimeDo = "0"}, new Step{TimeDo = "0",MusicUrl="ms-appx:///Assets/a6w/ex6.mp3",Cycle = "1/6",BaiTap = "6"}, new Step{}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "1/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "1/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "2/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "2/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "3/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "3/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "4/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "4/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "5/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "5/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, new Step{TimeDo = "0", MusicUrl="ms-appx:///Assets/a6w/up.mp3"}, new Step{TimeDo = "3",Image="Assets/a6w/6_1.png",Cycle = "6/6", MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "2",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "1",MusicUrl="ms-appx:///Assets/a6w/beep-07.mp3"}, new Step{TimeDo = "0",Image="Assets/a6w/1_3.png",Cycle = "6/6",MusicUrl="ms-appx:///Assets/a6w/down.mp3"}, new Step{TimeDo = "0"}, #endregion }; dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Stop(); }
public PopupView( UserControl viewToLoad, Brush primaryAccent, Brush secondaryAccent, bool autoHide, double timeToLive, string button1ClickContent = "", string button1ClickIdentifier = "", string button2ClickContent = "", string button2ClickIdentifier = "", double width = 100, double height = 100, string button1MetroIcon = "", double button1Rotation = 0, string button2MetroIcon = "", double button2Rotation = 0, UserControl toolbar = null, bool showInnerBorder = true ) { this.InitializeComponent(); if (viewToLoad == null) return; _button1ClickContent = button1ClickContent; _button1ClickIdentifier = button1ClickIdentifier; butTopRight1.ClickCode = _button1ClickContent; butTopRight1.ClickIdentifier = _button1ClickIdentifier; butTopRight1.Visibility = (string.IsNullOrEmpty(_button1ClickContent) || string.IsNullOrEmpty(button1MetroIcon)) ? Visibility.Collapsed : Visibility.Visible; butTopRight1.UpdateBackgroundColor(primaryAccent); if (!string.IsNullOrEmpty(button1MetroIcon)) butTopRight1.LoadMetroIcon(button1MetroIcon, rotation: button1Rotation); _button2ClickContent = button2ClickContent; _button2ClickIdentifier = button2ClickIdentifier; butTopRight2.ClickCode = _button2ClickContent; butTopRight2.ClickIdentifier = _button2ClickIdentifier; butTopRight2.Visibility = (string.IsNullOrEmpty(_button2ClickContent) || string.IsNullOrEmpty(button2MetroIcon)) ? Visibility.Collapsed : Visibility.Visible; butTopRight2.UpdateBackgroundColor(primaryAccent); if (!string.IsNullOrEmpty(button2MetroIcon)) butTopRight2.LoadMetroIcon(button2MetroIcon, rotation: button2Rotation); if (this.MainContent == null) { this.MainContent = viewToLoad; this.grdCustomControl.Children.Add(viewToLoad); } if (this.ToolbarContent == null && toolbar != null) { this.ToolbarContent = toolbar; this.grdToolbar.Children.Add(toolbar); } if (showInnerBorder) recInnerBorder.Visibility = Visibility.Visible; else recInnerBorder.Visibility = Visibility.Collapsed; this.Width = width; this.Height = height; //ggClip.Rect = new Rect(0, 0, width-20, height-40); ((DoubleAnimation)sbCountdown.Children[0]).Duration = new Duration(TimeSpan.FromSeconds(timeToLive)); if (timeToLive < 999) { recTimeLeft.Visibility = Visibility.Visible; dtClose = new DispatcherTimer(); dtClose.Interval = TimeSpan.FromSeconds(timeToLive); dtClose.Tick += (o, e) => { //sbCountdown.Stop(); dtClose.Stop(); this.Hide(); }; dtClose.Start(); } else { recTimeLeft.Visibility = Visibility.Collapsed; } }
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(); } }