Example #1
0
        protected override async void OnAfterSynchronizationFinished(SynchronizationMode mode, bool AutoSync)
        {
            // Handle the initial sync
            if (mode == SynchronizationMode.Initial)
            {
                // Clear out current MAC ID config
                SettingsDataService.ClearCurrentMobileConfigurationID();

                // Check count of MACs
                var configurations = await _mobileAppConfigDataService.GetMobileAppConfigs();

                if (configurations.Count > 1)
                {
                    // Pop the control open to select an appropriate MAC
                    ControlBarViewModel.IsSelectConfigurationPopupOpen = true;
                }
                else  // Auto set
                {
                    // Auto set the only Mac available
                    await SettingsDataService.SetCurrentMobileConfigurationID(configurations[0].Id);
                }
            }
            else  // If Full or Delta sync options
            {
                if (!AutoSync)
                {
                    await _dialogService.ShowMessage("Synchronization completed successfully", "Synchronization completed");
                }
            }
            Task.Factory.StartNew(AttachmentsFolder.Instance.DeleteOldVersionsWithContent);
            Task.Factory.StartNew(VersionDataFolder.Instance.DeleteOldVersionsWithContent);
        }
Example #2
0
 protected override async Task Initialize()
 {
     try
     {
         DispatcherHelper.CheckBeginInvokeOnUI(
             async() =>
         {
             LogoImage               = await _dataService.GetLogoImage();
             var currentConfig       = await SettingsDataService.GetCurrentMobileConfigurationID();
             IsConfigurationSelected = string.IsNullOrWhiteSpace(currentConfig) == false;
             RefreshCommands();
             RefreshCheckState();
         }
             );
     }
     catch (Exception ex)
     {
         // Report error here
     }
 }
        // //////////////////////////////////////////////////////////
        // *** Related Content ***
        // //////////////////////////////////////////////////////////
        private async Task CreateRelatedContentList(MediaLink media)
        {
            // Clear object if not empty
            _relatedContent.Clear();

            // Get the current user's MAC
            var mobileAppConfigurationId = await SettingsDataService.GetCurrentMobileConfigurationID();

            var categories = await _categoryDataService.GetCategories(mobileAppConfigurationId);


            // Get the CatCon list based on MACs
            var categoryContents = await _categoryContentDataService.GetCategoryContent(mobileAppConfigurationId);

            if (categoryContents != null && categoryContents.Any())
            {
                // Filter for the Category List based on the input mediaLink objects Id
                var tempCategoryIdList = (categoryContents.Where(cc => cc.ContentId == media.ID)).Select(x => x.CategoryId).Distinct();

                // Ge thet Parent category Ids and merge
                var parentCategoryIdList = categories.Where(x => tempCategoryIdList.Contains(x.Id)).Select(x => x.ParentCategory).Distinct();
                var categoryIdList       = tempCategoryIdList.Concat(parentCategoryIdList).Distinct();

                if (categoryIdList != null && categoryIdList.Any())
                {
                    // Filter the Content ID List based on the previous category List
                    var contentIds = categoryContents.Where(cc => categoryIdList.Contains(cc.CategoryId) && cc.ContentId != media.ID).Select(x => x.ContentId).Distinct();
                    if (contentIds != null && contentIds.Any())
                    {
                        // Generate the MediaLink List
                        var docInfoList = await _documentInfoDataService.GetContentDocumentsByID(contentIds);

                        if (docInfoList != null && docInfoList.Any())
                        {
                            _relatedContent = docInfoList.Select(d => new MediaLink(d)).ToList();
                        }
                    }
                }
            }
        }
        protected override async Task Initialize()
        {
            try
            {
                var currentID = await SettingsDataService.GetCurrentMobileConfigurationID();

                var configurations = await _mobileAppConfigDataService.GetMobileAppConfigs();

                var mcSelectViewModels = VisualBrowserViewModelBuilder.CreateMobileConfigurationsSelectionViewModel(configurations, SettingsDataService, currentID, () => { MobileConfigurations.ForEach(mc => mc.IsSelected = false); }, () => { IsSelectConfigurationPopupOpen = false; });
                MobileConfigurations = new ObservableCollection <MobileConfigurationsSelectionViewModel>(mcSelectViewModels);

                SetLogInOutStatus();

                IsInternalModeEnableChecked = IsInternalModeEnable;

                RefreshCommands();
                SetCheckInOutIcon(_presentationDataService);
                CheckInOutViewModel = new CheckInOutViewModel(_contactsService, _presentationDataService, SettingsDataService);
            }
            catch
            {
                //todo: log error
            }
        }