Ejemplo n.º 1
0
        public List <SearchTask> Execute(IList <SearchTask> searchTask, string storeResultDir)
        {
            var allTasks = new List <SearchTask>(searchTask);
            var groups   = searchTask.GroupBy(i => i.SearchDir);

            foreach (var group in groups)
            {
                var tasks = group.ToList();
somethingChanged:
                BaseConverter.Founded.Clear();
                List <SearchTask> allTasksPart;

                var projName = DirNameRegex.Match(tasks.First().SearchDir).Value;
                projName = CashParser.ToTitleCase(projName);

                var classes = RecursiveSearch(tasks, storeResultDir, true, out allTasksPart, projName);

                GenerateTestFileForApi(classes, tasks, projName);

                if (TaskHelper.AddTask(allTasks, allTasksPart))
                {
                    tasks = allTasksPart;
                    goto somethingChanged;
                }
            }
            return(allTasks);
        }
Ejemplo n.º 2
0
        private List <ParsedClass> RecursiveSearch(IList <SearchTask> searchTasks, string storeResultDir, bool enablePrint, out List <SearchTask> allTasks)
        {
            allTasks = new List <SearchTask>(searchTasks);
            var parsedClasses = new List <ParsedClass>();

            foreach (var task in searchTasks)
            {
                if (string.IsNullOrWhiteSpace(task.SearchLine))
                {
                    continue;
                }

                var parsedClass = FindAndParse(task, storeResultDir, enablePrint);
                if (parsedClass != null)
                {
                    parsedClasses.Add(parsedClass);
                }
            }

            if (BaseConverter.UnknownTypes.Any())
            {
                var buf = BaseConverter.UnknownTypes.ToList();
                BaseConverter.UnknownTypes.Clear();
                var hasNew = TaskHelper.AddTask(allTasks, buf);
                if (hasNew)
                {
                    List <SearchTask> bReq;
                    var parts = RecursiveSearch(buf, storeResultDir, enablePrint, out bReq);
                    parsedClasses.AddRange(parts);
                    TaskHelper.AddTask(allTasks, bReq);
                }
            }

            return(parsedClasses);
        }
Ejemplo n.º 3
0
        public void PubMsg(int num, Model.MsgContent msg, Model.SubMsg sub)
        {
            var result = HttpHelper.Post(sub.ReceiveContent, msg.Content);

            ServerManager.ServerHelper.GetLogImp.AddPushLog(new Model.PushLog
            {
                MsgNo      = msg.MsgNo,
                PushStatus = result,
                PushTime   = DateTime.Now,
                PushType   = sub.ReceiveType,
                SubAppNo   = sub.AppNo
            });
            if (result != "OK")
            {
                switch (num)
                {
                case 0:
                    Task.Factory.StartNew(() =>
                    {
                        Thread.Sleep(10 * 1000);
                        TaskHelper.AddTask(new Task(() => this.PubMsg(1, msg, sub)));
                    });
                    break;

                case 1:
                    Task.Factory.StartNew(() =>
                    {
                        Thread.Sleep(60 * 1000);
                        TaskHelper.AddTask(new Task(() => this.PubMsg(2, msg, sub)));
                    });
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public void PubMsg(int num, Model.MsgContent msg, Model.SubMsg sub)
        {
            var name   = string.Format(NAME_FORMAT, msg.AppNo, msg.AppEvent);
            var result = ServerManager.ServerHelper.GetQueueImp.Publish(name, msg.Content);

            ServerManager.ServerHelper.GetLogImp.AddPushLog(new Model.PushLog
            {
                MsgNo      = msg.MsgNo,
                PushStatus = result.ToString(CultureInfo.InvariantCulture),
                PushTime   = DateTime.Now,
                PushType   = "client",
                SubAppNo   = "client all"
            });
            if (result < 0)
            {
                switch (num)
                {
                case 0:
                    Task.Factory.StartNew(() =>
                    {
                        Thread.Sleep(10 * 1000);
                        TaskHelper.AddTask(new Task(() => this.PubMsg(1, msg, sub)));
                    });
                    break;

                case 1:
                    Task.Factory.StartNew(() =>
                    {
                        Thread.Sleep(60 * 1000);
                        TaskHelper.AddTask(new Task(() => this.PubMsg(2, msg, sub)));
                    });
                    break;
                }
            }
        }
        public ActionResult AddTask(TaskViewModel model)
        {
            if (ModelState.IsValid)
            {
                TaskHelper.AddTask(model.ProjectId, model.Title, model.Description, model.Priority, model.Status, model.Deadline, model.DeveloperId);
            }
            var userId = User.Identity.GetUserId();
            var users  = TaskHelper.getAllDeveloperUserExceptProjectManagerId(userId);

            ViewBag.DeveloperId = new SelectList(users, "Id", "UserName");
            return(RedirectToAction("Index", "ProjectManager"));
        }
Ejemplo n.º 6
0
        /// 이 섹션에서 제공되는 메서드는 NavigationHelper에서
        /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다.
        ///
        /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다.
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다.
        /// 탐색 매개 변수는 LoadState 메서드
        /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.NavigationHelper.OnNavigatedTo(e);

            // Check nick name at frist login.
            if (!App.ApplicationSettings.Contains(Switcher.MAIN_PLATFORM_TYPE_KEY))
            {
                App.ApplicationSettings[Switcher.MAIN_PLATFORM_TYPE_KEY] = AppResources.OneDrive;
            }

            // Check nick name at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY))
            {
                App.ApplicationSettings[StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY] = AppResources.AtHere;
            }

            // Check location access consent at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.LOCATION_ACCESS_CONSENT_KEY))
            {
                App.ApplicationSettings[StorageAccount.LOCATION_ACCESS_CONSENT_KEY] = false;
            }

            // For Test
            this.SettingsForPresentation();

            // Do Signin work of each cloud storage.
            if (App.AccountManager.IsSignIn())
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    TaskHelper.AddTask(App.AccountManager.GetPtcId(), App.AccountManager.SignIn());
                    using (var itr = StorageHelper.GetStorageEnumerator())
                    {
                        while (itr.MoveNext())
                        {
                            if (itr.Current.IsSignIn())
                            {
                                TaskHelper.AddSignInTask(itr.Current.GetStorageName(), itr.Current.SignIn());
                            }
                        }
                    }
                }
                this.Frame.Navigate(typeof(SpotListPage));
            }
            else
            {
                this.Frame.Navigate(typeof(SpotListPage));
            }
        }
Ejemplo n.º 7
0
        public ActionResult AddTask(TaskModel task, Guid projectId, Guid Staffs)
        {
            var managerEmail = Session["LoginName"].ToString();
            var managerId    = db.Managers.Where(m => m.Email == managerEmail).FirstOrDefault().Id;

            ViewBag.Staffs = new SelectList(db.Staffs.Where(s => s.ManagerId == managerId), "Id", "Name");

            bool isSuccess = TaskHelper.AddTask(task, projectId, Staffs, db);

            if (isSuccess)
            {
                return(Redirect(Url.Action("Index", "Home")));
            }
            return(View(new Task()));
        }
        private void uiRefreshButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            switch (uiExplorerList.SelectedIndex)
            {
            case EventHelper.PICK_PIVOT:
                this.PickFileObjectViewModel.IsDataLoaded = false;
                this.SetPickPivot(AppResources.Refreshing);
                break;


            case EventHelper.PIN_PIVOT:
                this.PinFileObjectViewModel.IsDataLoaded = false;
                TaskHelper.AddTask(TaskHelper.STORAGE_EXPLORER_SYNC + Switcher.GetCurrentStorage().GetStorageName(), StorageExplorer.Refresh());
                this.SetPinPivot(AppResources.Refreshing);
                break;
            }
        }
        public async Task <bool> SignIn()
        {
            this.tcs = new TaskCompletionSource <bool>();
            try
            {
                // If it haven't registerd live client, register
                LiveConnectClient liveClient = await this.GetLiveConnectClientAsync();

                this.LiveClient = liveClient;

                // Get id and name.
                LiveOperationResult operationResult = await this.LiveClient.GetAsync("me");

                string accountId       = (string)operationResult.Result["id"];
                string accountUserName = (string)operationResult.Result["name"];

                // Register account
                await TaskHelper.WaitTask(App.AccountManager.GetPtcId());

                StorageAccount storageAccount = await App.AccountManager.GetStorageAccountAsync(accountId);

                if (storageAccount == null)
                {
                    storageAccount             = new StorageAccount();
                    storageAccount.Id          = accountId;
                    storageAccount.StorageName = this.GetStorageName();
                    storageAccount.UserName    = accountUserName;
                    storageAccount.UsedSize    = 0.0;
                    await App.AccountManager.CreateStorageAccountAsync(storageAccount);
                }
                this.CurrentAccount = storageAccount;

                // Save sign in setting.
                App.ApplicationSettings[ONE_DRIVE_SIGN_IN_KEY] = true;
                App.ApplicationSettings.Save();
                TaskHelper.AddTask(TaskHelper.STORAGE_EXPLORER_SYNC + this.GetStorageName(), StorageExplorer.Synchronize(this.GetStorageName()));
                tcs.SetResult(true);
            }
            catch
            {
                tcs.SetResult(false);
            }

            return(tcs.Task.Result);
        }
Ejemplo n.º 10
0
 public override void Execute()
 {
     TaskHelper.AddTask(() =>
     {
         while (isActive)
         {
             Thread.Sleep(threadTime);
             lock (lockObj)
             {
                 //更新决策
                 server.Execute();
             }
         }
     }, () =>
     {
         ECSLocate.Log.LogWarning("决策更新结束");
     });
 }
Ejemplo n.º 11
0
        public List <SearchTask> Execute(IList <SearchTask> tasks, string storeResultDir)
        {
            var allTasks = new List <SearchTask>(tasks);

somethingChanged:
            BaseConverter.Founded.Clear();

            var classes = RecursiveSearch(tasks, storeResultDir, true, out var allTasksPart);

            GenerateTestFileForApi(classes, tasks);

            if (TaskHelper.AddTask(allTasks, allTasksPart))
            {
                tasks = allTasksPart;
                goto somethingChanged;
            }

            return(allTasks);
        }
Ejemplo n.º 12
0
        private async void CreateTask_Button_Clicked(object sender, System.EventArgs e)
        {
            string taskTitle    = TaskEntry.Text;
            int    roleId       = (RolePicker.SelectedIndex == -1) ? SessionState.CurrentRoleId : RolePicker.SelectedIndex;
            int    priority     = PriorityPicker.SelectedIndex;
            string user         = (string)UserPicker.SelectedItem;
            var    deadineDate  = DeadlineDatePicker.Date;
            var    deadlineTime = DeadlineTimePicker.Time;

            var deadlineDateTime = new DateTime(deadineDate.Year, deadineDate.Month, deadineDate.Day,
                                                deadlineTime.Hours, deadlineTime.Minutes, deadlineTime.Seconds);

            if (String.IsNullOrEmpty(taskTitle))
            {
                await DisplayAlert("Action Error", "Empty task title", "OK");

                return;
            }

            var task = new Models.Task
            {
                Id        = (CreateButton.Text == "Update Task") ? TaskIdEntry.Text : Guid.NewGuid().ToString(),
                TaskTitle = taskTitle,
                RoleId    = roleId,
                Priority  = priority,
                User      = user,
                Username  = SessionState.CurrentUser.Username,
                Deadline  = deadlineDateTime,
            };

            if (CreateButton.Text == "Update Task")
            {
                TaskHelper.UpdateTask(task);
            }
            else
            {
                TaskHelper.AddTask(task);
            }
            await DisplayAlert("Excellent!!", "Task was created successfully", "OK");

            await Navigation.PushAsync(new TasksListPage());
        }
Ejemplo n.º 13
0
        private async void AddTask()
        {
            var name        = NameEntry.Text;
            var description = DescriptionEditor.Text;
            var priority    = PriorityPicker.SelectedIndex;
            var date        = ExpirationDatePicker.Date;
            var time        = ExpirationTimePicker.Time;

            if (name == "" || priority == -1 || RolePicker.SelectedIndex == -1)
            {
                await DisplayAlert("Error", "Not all values set", "OK");

                return;
            }

            var role = Roles[RolePicker.SelectedIndex];

            var color = role.Color;

            var expirationDateTime = new DateTime(date.Year, date.Month, date.Day, time.Hours, time.Minutes, time.Seconds);



            var task = new Task
            {
                Id             = Guid.NewGuid().ToString(),
                CreatedDate    = DateTime.Now,
                Description    = description,
                Name           = name,
                ExpirationDate = expirationDateTime,
                Priority       = priority,
                Color          = color,
                Role           = role.Name,
                RoleId         = role.Id
            };

            TaskHelper.AddTask(task);

            await Navigation.PopModalAsync();
        }
Ejemplo n.º 14
0
        public JsonResult Save(string data, string action)
        {
            try
            {
                var taskmodel = JsonHelper.ToObject <TaskModel>(data);

                var result = false;
                if (QuartzHelper.ValidExpression(taskmodel.CronExpressionString))
                {
                    result = TaskHelper.AddTask(taskmodel, action);
                    return(Json(new { result = false, msg = "保存成功" }));
                }
                else
                {
                    return(Json(new { result = false, msg = "Cron表达式错误" }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, msg = ex.Message }));
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Adds a new task to the list
        /// </summary>
        /// <param name="name">The name of the task</param>
        /// <returns>The response</returns>
        private object AddTask(string name)
        {
            try
            {
                if (string.IsNullOrEmpty(name))
                {
                    return(ResponseMessage("The name of the desired task is missing.", HttpStatusCode.BadRequest));
                }

                _taskHelper.AddTask(name);

                return(ResponseMessage("Task added"));
            }
            catch (EndpointNotFoundException)
            {
                return(ResponseMessage("The specified task doesn't exist.", HttpStatusCode.NotFound));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }
Ejemplo n.º 16
0
        private async void save_Click(object sender, EventArgs e)
        {
            SetProgressIndicator(true);
            SystemTray.ProgressIndicator.Text = "Saving Task";

            if (!string.IsNullOrEmpty(txtbxTitle.Text.Trim()))
            {
                //Disable buttons
                ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = false;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = false;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[2]).IsEnabled = false;

                if (!_id.Equals("new"))
                {
                    var s = from p in App.TaskViewModel.TaskItem
                            where p.id == _id
                            select p;

                    //Set the variables
                    var taskItem = s.First();

                    string oldNotes = null;
                    string newNotes = null;
                    if (taskItem.notes != null)
                    {
                        oldNotes = taskItem.notes;
                    }
                    if (txtNotes.Text.Trim() != null && txtNotes.Text.Trim() != "")
                    {
                        newNotes = txtNotes.Text.Trim();
                    }

                    string oldDue = null;
                    string newDue = null;
                    if (taskItem.due != null)
                    {
                        oldDue = Convert.ToDateTime(Universal.ConvertToUniversalDate(taskItem.due)).ToString("yyyy-MM-dd'T'hh:mm:ss.00Z");
                    }
                    if (txtDueDate.Value.ToString() != null)
                    {
                        newDue = GetReminderDateTime();
                    }

                    //check for changes before submitting to google
                    if (taskItem.title != txtbxTitle.Text.Trim() || oldNotes != newNotes || oldDue != newDue)
                    {
                        taskItem.title = txtbxTitle.Text.Trim();
                        taskItem.notes = newNotes;
                        taskItem.due   = newDue;

                        //Update the task
                        bool result = await taskItem.Update(GetResponse);

                        // Update the task locally
                        List <TaskListItem> lists = await TaskListHelper.GetTaskListFromApplicationStorage();

                        foreach (TaskListItem list in lists)
                        {
                            foreach (TaskItem task in list.taskList.Where(x => x.id == _id))
                            {
                                task.title   = taskItem.title;
                                task.notes   = taskItem.notes;
                                task.due     = taskItem.due;
                                task.updated = DateTime.UtcNow.ToString("yyyy-MM-dd'T'hh:mm:ss.00Z"); //DateTime.UtcNow.ToString();
                            }
                        }

                        // Resubmit the list to local storage
                        await TaskListHelper.SubmitToLocalStorage(lists);

                        if (result)
                        {
                            if (GTaskSettings.MsgUpdateTask)
                            {
                                MessageBoxResult m = MessageBox.Show("Complete.", "Update Task", MessageBoxButton.OK);
                            }
                        }
                        else
                        {
                            MessageBoxResult m = MessageBox.Show("This task was updated while offline, please sync once back online.", "Offline Mode", MessageBoxButton.OK);
                        }
                    }

                    NavigationService.Navigate(new Uri("/Views/TaskView.xaml?Id=" + _listId, UriKind.RelativeOrAbsolute));
                }
                else //if it is new
                {
                    var t = new TaskItem {
                    };
                    t.title = txtbxTitle.Text.Trim();
                    t.notes = txtNotes.Text.Trim();

                    if (!string.IsNullOrEmpty(txtDueDate.Value.ToString()))
                    {
                        t.due = GetReminderDateTime();
                    }
                    else
                    {
                        t.due = null;
                    }

                    //Create the Task
                    TaskItem result = await TaskHelper.AddTask(t, GetResponse, _listId);

                    if (result != null)
                    {
                        // Refresh the data
                        await GTaskSettings.RefreshData(false, _listId, true);

                        if (GTaskSettings.MsgCreateTask)
                        {
                            MessageBoxResult n = MessageBox.Show("Complete.", "Create Task", MessageBoxButton.OK);
                        }
                    }
                    else
                    {
                        // Create a random ID
                        t.id       = Guid.NewGuid().ToString();
                        t.status   = "needsAction";
                        t.updated  = DateTime.UtcNow.ToString("yyyy-MM-dd'T'hh:mm:ss.00Z");
                        t.kind     = "tasks#task";
                        t.selfLink = "https://www.googleapis.com/tasks/v1/lists/" + _listId + "/tasks/" + t.id;

                        // Add a setting to flag the list
                        var settings = IsolatedStorageSettings.ApplicationSettings;
                        settings.Add("Task_" + t.id + "_Action", "added");
                        settings.Add("Task_" + t.id + "_Timestamp", DateTime.UtcNow.ToString());

                        // Get local storage
                        List <TaskListItem> list = await TaskListHelper.GetTaskListFromApplicationStorage();

                        // Set the position
                        // Check if there are items in the current list
                        if (list.Where(x => x.id == _listId).First().taskList.Count() > 0)
                        {
                            t.position = (double.Parse(list.Where(x => x.id == _listId).First().taskList.OrderBy(x => x.position).First().position) - 1).ToString();
                        }
                        else
                        {
                            t.position = "10000";
                        }

                        // Add the task to the list
                        list.Where(x => x.id == _listId).First().taskList.Insert(0, t);

                        // Resubmit the list to local storage
                        await TaskListHelper.SubmitToLocalStorage(list);

                        MessageBoxResult m = MessageBox.Show("This task was created while offline, please sync once back online.", "Offline Mode", MessageBoxButton.OK);
                    }

                    //Navigate back to TaskView if "New"
                    //Given we don't know the TaskID of this item yet, if you don't return it will create multiple identical tasks
                    NavigationService.Navigate(new Uri("/Views/TaskView.xaml?Id=" + _listId, UriKind.RelativeOrAbsolute));
                }
            }
            else
            {
                MessageBoxResult o = MessageBox.Show("Well, hello there! Do you mind including a Title?", "Title?", MessageBoxButton.OK);
            }

            //re-enable buttons
            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
            ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true;
            ((ApplicationBarIconButton)ApplicationBar.Buttons[2]).IsEnabled = true;

            SetProgressIndicator(false);
        }
Ejemplo n.º 17
0
        public async Task <bool> SignIn()
        {
            this.tcs = new TaskCompletionSource <bool>();
            // Add application settings before work for good UX
            try
            {
                //Uri clientSecretsUri = new Uri("/Utilities/google_secret.json",UriKind.Relative);
                //new ClientSecrets
                //    {
                //        ClientId = GOOGLE_DRIVE_CLIENT_ID,
                //        ClientSecret = GOOGLE_DRIVE_CLIENT_SECRET
                //    }
                this.Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    new Uri("ms-appx:///Assets/client_secret.json"),
                    new[] { DriveService.Scope.Drive },
                    this._GetUserSession(),
                    CancellationToken.None
                    );

                this.Service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = this.Credential,
                    ApplicationName       = "athere",
                });
                AboutResource aboutResource = this.Service.About;
                About         about         = await aboutResource.Get().ExecuteAsync();

                this.User = about.User;

                string name = this.User.DisplayName;
                string id   = about.PermissionId;

                // Register account
                StorageAccount account = await App.AccountManager.GetStorageAccountAsync(id);

                if (account == null)
                {
                    account = new StorageAccount(id, StorageAccount.StorageAccountType.GOOGLE_DRIVE, name, 0.0);
                    await App.AccountManager.CreateStorageAccountAsync(account);
                }
                this.CurrentAccount = account;

                // Save sign in setting.
                App.ApplicationSettings[GOOGLE_DRIVE_SIGN_IN_KEY] = true;
                App.ApplicationSettings.Save();
                TaskHelper.AddTask(TaskHelper.STORAGE_EXPLORER_SYNC + this.GetStorageName(), StorageExplorer.Synchronize(this.GetStorageName()));
                tcs.SetResult(true);
            }
            catch (Google.GoogleApiException e)
            {
                Debug.WriteLine(e.ToString());
                System.Diagnostics.Debugger.Break();
                tcs.SetResult(false);
            }
            catch (System.Threading.Tasks.TaskCanceledException)
            {
                tcs.SetResult(false);
                System.Diagnostics.Debugger.Break();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                tcs.SetResult(false);
                System.Diagnostics.Debugger.Break();
            }

            return(tcs.Task.Result);
        }
Ejemplo n.º 18
0
        public void TestInit1()
        {
            //App.MobileService = new MobileServiceClient(
            //    "https://pinthecloud.azure-mobile.net/",
            //    "yvulzHAGRgNsGnPLHKcEFCPJcuyzKj23"
            //);
            App.ApplicationSessions = new WSApplicationSessions();
            App.ApplicationSettings = new WSApplicationSettings();

            // Manager
            App.SpotManager         = new SpotManager();
            App.Geolocator          = new Geolocator();
            App.BlobStorageManager  = new BlobStorageManager();
            App.LocalStorageManager = new LocalStorageManager();

            IStorageManager OneDriveManager   = new OneDriveManager();
            IStorageManager DropBoxManager    = new DropboxManager();
            IStorageManager GoogleDriveManger = new GoogleDriveManager();


            /////////////////////////////////////////////////////
            // This order will be displayed at every App Pages
            /////////////////////////////////////////////////////
            StorageHelper.AddStorageManager(OneDriveManager.GetStorageName(), OneDriveManager);
            StorageHelper.AddStorageManager(DropBoxManager.GetStorageName(), DropBoxManager);
            StorageHelper.AddStorageManager(GoogleDriveManger.GetStorageName(), GoogleDriveManger);
            Switcher.SetStorageToMainPlatform();
            App.AccountManager = new AccountManager();


            if (!App.ApplicationSettings.Contains(Switcher.MAIN_PLATFORM_TYPE_KEY))
            {
                App.ApplicationSettings[Switcher.MAIN_PLATFORM_TYPE_KEY] = AppResources.OneDrive;
            }

            // Check nick name at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY))
            {
                App.ApplicationSettings[StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY] = AppResources.AtHere;
            }

            // Check location access consent at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.LOCATION_ACCESS_CONSENT_KEY))
            {
                App.ApplicationSettings[StorageAccount.LOCATION_ACCESS_CONSENT_KEY] = false;
            }


            // Do Signin work of each cloud storage.
            if (App.AccountManager.IsSignIn())
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    TaskHelper.AddTask(App.AccountManager.GetPtcId(), App.AccountManager.SignIn());
                    using (var itr = StorageHelper.GetStorageEnumerator())
                    {
                        while (itr.MoveNext())
                        {
                            if (itr.Current.IsSignIn())
                            {
                                TaskHelper.AddSignInTask(itr.Current.GetStorageName(), itr.Current.SignIn());
                            }
                        }
                    }
                }
            }
        }
 public void AddTask(string searchLine, KnownConverter converter, string searchDir)
 {
     TaskHelper.AddTask(Items, searchLine, converter, searchDir);
     OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
 }