Esempio n. 1
0
        private async void MfiRemove_Click(object sender, RoutedEventArgs e)
        {
            SyncPair sync = (SyncPair)((FrameworkElement)sender).DataContext;

            if (await DialogUtils.ShowTwoOptionsAsync(sync.Name ?? string.Empty, "Delete?", "Yes", "No"))
            {
                viewModel.Syncs.Remove(sync);
                App.SaveSyncPairs();
            }
        }
Esempio n. 2
0
        private async void AbbAddSyncPair_Click(object sender, RoutedEventArgs e)
        {
            SyncPair     newSync = new SyncPair();
            SyncPairEdit edit    = new SyncPairEdit(newSync, viewModel.Api);

            Frame.Navigate(typeof(SyncEditPage), edit);

            if (await edit.Task)
            {
                viewModel.Syncs.Add(newSync);
                App.SaveSyncPairs();
            }
        }
Esempio n. 3
0
        private void IbnRunSync_Click(object sender, RoutedEventArgs e)
        {
            SyncPairHandler handler;
            SyncPair        sync = (SyncPair)((FrameworkElement)sender).DataContext;

            if (BackgroundTaskHelper.Current.TryGetHandler(sync.Token, out handler) &&
                IsRunning(handler.State))
            {
                handler.Cancel();
            }
            else
            {
                BackgroundTaskHelper.Current.Start(sync, viewModel.Api);
            }
        }
Esempio n. 4
0
        private async void MfiEdit_Click(object sender, RoutedEventArgs e)
        {
            SyncPair     oldSync = (SyncPair)((FrameworkElement)sender).DataContext;
            SyncPair     newSync = oldSync.Clone();
            SyncPairEdit edit    = new SyncPairEdit(newSync, viewModel.Api);

            Frame.Navigate(typeof(SyncEditPage), edit);

            int index;

            if (await edit.Task && viewModel.Syncs.TryIndexOf(s => s.Token == oldSync.Token, out index))
            {
                viewModel.Syncs[index] = newSync;
                App.SaveSyncPairs();
            }
        }
Esempio n. 5
0
        private async void MfiRunWIthModeItem_Click(object sender, RoutedEventArgs e, SyncMode mode)
        {
            SyncPair sync = UwpUtils.GetDataContext <SyncPair>(sender);

            await BackgroundTaskHelper.Current.Start(sync, viewModel.Api, mode : mode);
        }
 public SyncPairEdit(SyncPair sync, Api api)
 {
     Sync = sync;
     Api  = api;
 }