public static async Task UpdateTilesAsync(AccountDataItem account, AccountDataStore data, IEnumerable <SecondaryTile> tilesForAccount) { foreach (var tile in tilesForAccount) { var args = ArgumentsHelper.Parse(tile.Arguments) as ViewClassArguments; if (args != null) { await UpdateTileAsync(tile, account, data, args.ItemId); } } }
public static int Main(string[] args) { // cloudcopy.exe "source" "destination" "blobcnstring (default dev storage)" -flags // cloudcopy.exe "C:\Test\*.*" "mycontainer/myfolder" "DefaultEndpointsProtocal=http;AccountName=userdevelopment;AccountKey=accKey" // cloudcopy.exe "C:\Test\*.*" "/mycontainer/myfolder" "DefaultEndpointsProtocal=http;AccountName=userdevelopment;AccountKey=accKey" // cloudcopy.exe "/mycontainer/myfolder" "C:\Test\*.*" "DefaultEndpointsProtocal=http;AccountName=userdevelopment;AccountKey=accKey" // cloudcopy.exe "/mycontainer/myfolder" "/mycontainer/myfolder" "DefaultEndpointsProtocal=http;AccountName=userdevelopmentA;AccountKey=accKeyA" "DefaultEndpointsProtocal=http;AccountName=userdevelopmentB;AccountKey=accKeyB" // cloudcopy.exe "C:\Test\*.*" "/mycontainer/myfolder" // cloudcopy.exe "/mycontainer/myfolder" "DefaultEndpointsProtocal=http;AccountName=userdevelopment;AccountKey=accKey" -L if (ArgumentsHelper.Parse(args)) { return(RunCommands() ? 0 : 1); } else { return(1); } }
public async void Handle(BackgroundActivatedEventArgs args) { var taskInstance = args.TaskInstance; taskInstance.Canceled += TaskInstance_Canceled; var deferral = taskInstance.GetDeferral(); try { var toastActionTrigger = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail; var toastArgs = ArgumentsHelper.Parse(toastActionTrigger.Argument); if (toastArgs is BaseArgumentsWithAccount toastArgsWithAccount) { Guid localAccountId = toastArgsWithAccount.LocalAccountId; if (localAccountId == Guid.Empty) { return; } AccountDataItem account = await AccountsManager.GetOrLoad(localAccountId); if (account == null) { return; } var cancellationToken = _cancellationTokenSource.Token; try { cancellationToken.ThrowIfCancellationRequested(); if (toastArgs is MarkTasksCompleteArguments markCompleteArgs) { TelemetryExtension.Current?.TrackEvent("ToastMarkedCompleted"); DataChanges changes = new DataChanges(); foreach (var id in markCompleteArgs.ItemIds) { changes.Add(new DataItemMegaItem() { Identifier = id, PercentComplete = 1 }, onlyEdit: true); } // Need to wait for all tile/toast tasks to complete before returning and completing deferral await PowerPlannerApp.Current.SaveChanges(account, changes, waitForSaveAndSyncTasks : true); } } catch (OperationCanceledException) { } // Wait for the calendar integration to complete await AppointmentsExtension.Current?.GetTaskForAllCompleted(); } } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } finally { deferral.Complete(); } }
private async void HandleIntent() { try { if (Intent.Action == Intent.ActionView && Intent.DataString != null && Intent.DataString.StartsWith("powerplanner:?")) { var args = ArgumentsHelper.Parse(Intent.DataString.Substring("powerplanner:?".Length)); LaunchSurface launchContext = LaunchSurface.Normal; if (args != null) { launchContext = args.LaunchSurface; } var viewModel = _mainAppWindow.GetViewModel(); if (args is ViewPageArguments) { var viewPageArgs = args as ViewPageArguments; TrackLaunch(args, launchContext, "View" + viewPageArgs.Page); switch (viewPageArgs.Page) { // View agenda case ViewPageArguments.Pages.Agenda: await viewModel.HandleViewAgendaActivation(viewPageArgs.LocalAccountId); return; } } else if (args is ViewScheduleArguments) { var viewScheduleArgs = args as ViewScheduleArguments; TrackLaunch(args, launchContext, "ViewSchedule"); await viewModel.HandleViewScheduleActivation(viewScheduleArgs.LocalAccountId); return; } else if (args is ViewClassArguments) { var viewClassArgs = args as ViewClassArguments; TrackLaunch(args, launchContext, "ViewClass"); await viewModel.HandleViewClassActivation(viewClassArgs.LocalAccountId, viewClassArgs.ItemId); return; } else if (args is ViewHolidayArguments) { var viewHolidayArgs = args as ViewHolidayArguments; TrackLaunch(args, launchContext, "ViewHoliday"); await viewModel.HandleViewHolidayActivation(viewHolidayArgs.LocalAccountId, viewHolidayArgs.ItemId); return; } else if (args is ViewHomeworkArguments) { TrackLaunch(args, launchContext, "HomeworkExam"); var viewHomeworkArgs = args as ViewHomeworkArguments; await viewModel.HandleViewHomeworkActivation(viewHomeworkArgs.LocalAccountId, viewHomeworkArgs.ItemId); return; } else if (args is ViewExamArguments) { TrackLaunch(args, launchContext, "HomeworkExam"); var viewExamArgs = args as ViewExamArguments; await viewModel.HandleViewExamActivation(viewExamArgs.LocalAccountId, viewExamArgs.ItemId); return; } else if (args is QuickAddToCurrentAccountArguments) { TrackLaunch(args, launchContext, "QuickAdd"); await viewModel.HandleQuickAddActivation(Guid.Empty); return; } else if (args is QuickAddArguments) { TrackLaunch(args, launchContext, "QuickAdd"); var quickAddArgs = args as QuickAddArguments; await viewModel.HandleQuickAddActivation(quickAddArgs.LocalAccountId); return; } // Otherwise still track launch if from special surface TrackLaunch(args, launchContext, "Launch"); } } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } // For all other cases (like ActionMain), fallback action is launch as main await _mainAppWindow.GetViewModel().HandleNormalLaunchActivation(); }
private static async System.Threading.Tasks.Task HandleArguments(MainAppWindow mainAppWindow, string arguments, LaunchSurface launchContext) { try { MainWindowViewModel viewModel = mainAppWindow.GetViewModel(); var args = ArgumentsHelper.Parse(arguments); Guid desiredLocalAccountId = Guid.Empty; if (args is BaseArgumentsWithAccount) { desiredLocalAccountId = (args as BaseArgumentsWithAccount).LocalAccountId; } else { desiredLocalAccountId = AccountsManager.GetLastLoginLocalId(); } Guid currentLocalAccountId = Guid.Empty; if (viewModel.CurrentAccount != null) { currentLocalAccountId = viewModel.CurrentAccount.LocalAccountId; } // View schedule if (args is ViewScheduleArguments) { TrackLaunch(args, launchContext, "Schedule"); await viewModel.HandleViewScheduleActivation(desiredLocalAccountId); } // View class else if (args is ViewClassArguments) { TrackLaunch(args, launchContext, "Class"); var viewClassArgs = args as ViewClassArguments; await viewModel.HandleViewClassActivation(viewClassArgs.LocalAccountId, viewClassArgs.ItemId); } else if (args is ViewTaskArguments) { TrackLaunch(args, launchContext, "Task"); var viewTaskArgs = args as ViewTaskArguments; await viewModel.HandleViewTaskActivation(viewTaskArgs.LocalAccountId, viewTaskArgs.ItemId); } else if (args is ViewEventArguments) { TrackLaunch(args, launchContext, "Event"); var viewEventArgs = args as ViewEventArguments; await viewModel.HandleViewEventActivation(viewEventArgs.LocalAccountId, viewEventArgs.ItemId); } else if (args is ViewHolidayArguments) { TrackLaunch(args, launchContext, "Holiday"); var viewHolidayArgs = args as ViewHolidayArguments; await viewModel.HandleViewHolidayActivation(viewHolidayArgs.LocalAccountId, viewHolidayArgs.ItemId); } else if (args is QuickAddArguments) { TrackLaunch(args, launchContext, "QuickAdd"); var quickAddArgs = args as QuickAddArguments; await viewModel.HandleQuickAddActivation(quickAddArgs.LocalAccountId); } else if (args is QuickAddTaskToCurrentAccountArguments) { // Jump list was created before we included the launch surface, so we'll manually port it if (launchContext == LaunchSurface.Normal) { launchContext = LaunchSurface.JumpList; } TrackLaunch(args, launchContext, "QuickAddTask"); await viewModel.HandleQuickAddTask(); } else if (args is QuickAddEventToCurrentAccountArguments) { // Jump list was created before we included the launch surface, so we'll manually port it if (launchContext == LaunchSurface.Normal) { launchContext = LaunchSurface.JumpList; } TrackLaunch(args, launchContext, "QuickAddEvent"); await viewModel.HandleQuickAddEvent(); } else { TrackLaunch(args, launchContext, "Launch"); if (viewModel.Content == null) { await viewModel.HandleNormalLaunchActivation(); } } } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } }
private const double MemoryLimitationCoefficient = 0.15; // using to calculate memory limitation as total available memory * this coefficient public static ArchiverSettings Get(string[] arguments) { var parsedArguments = ArgumentsHelper.Parse <ArchiverArguments>(arguments); return(MapSettings(parsedArguments)); }