public async Task Start(IEnumerable <SyncPair> syncs, Api api, bool isTestRun = false, SyncMode?mode = null) { bool addedHandler = false; foreach (SyncPair pair in syncs) { SyncPairHandler handler; if (handlers.TryGetValue(pair.Token, out handler) && !handler.IsEnded) { continue; } handler = SyncPairHandler.FromSyncPair(pair, api, isTestRun, mode); Queue.Enqueue(handler); handlers[handler.Token] = handler; AddedHandler?.Invoke(this, handler); addedHandler = true; } if (!addedHandler || IsRunning) { return; } if (appTrigger == null) { RegisterAppBackgroundTask(); } await appTrigger.RequestAsync(); }
public void Added(object sender, RoutedEventArgs e) { Material m; try { m = new Material(int.MaxValue, tbName.Text, tbDescription.Text, tbunit.Text, long.Parse(tbStock.Text), long.Parse(tbMinStock.Text)); AddedHandler?.Invoke(this, m); Close(); } catch (Exception ex) { MessageBox.Show("Bitte Eingaben überprüfen", "Fehlerhafte Eingabe"); } }
public void Added(object sender, RoutedEventArgs e) { AddedHandler?.Invoke(this, new Patient(int.MaxValue, tbName.Text, tbfirstName.Text, dpBirthday.SelectedDate, tbAdress.Text, dpEntry.SelectedDate)); Close(); }