Пример #1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            try
            {
                serviceDeferral        = taskInstance.GetDeferral();
                taskInstance.Canceled += OnTaskCanceled;

                ExecutingPlatform.Current = AppPlatform.UWP;
                var context = new EfCoreContext();
                var utData  = context.SetupSingleDtoAndEntities <AccountViewModel>();
                utData.AddSingleDto <CategoryViewModel>();
                utData.AddSingleDto <PaymentViewModel>();
                utData.AddSingleDto <RecurringPaymentViewModel>();

                var crudService = new CrudServicesAsync(context, utData.ConfigAndMapper);

                var liveTileManager = new LiveTileManager(crudService);
                await liveTileManager.UpdatePrimaryLiveTile();

                await liveTileManager.UpdateSecondaryLiveTiles();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                Debug.WriteLine("LiveTile update failed.");
            }
            finally
            {
                serviceDeferral?.Complete();
            }
        }
Пример #2
0
        private void loadStartup()
        {
            DataContext = App.ViewModel;
            InitializeComponent();

            agendaViewAppbar();
            watchScrollingOfLls();
            LiveTileManager.UpdateTileFromForeground();
            startResourceIntensiveAgent();
        }
Пример #3
0
        private void Pin_Click(object sender, EventArgs e)
        {
            string title       = selTopicTitle;
            string backTitle   = "Topic";
            string backContent = selTopicTitle;
            string pageUrl     = "/Views/TopicItems.xaml?indexId=" + selTopic + "&indexTitle=" + selTopicTitle;

            LiveTileManager.CreateLiveTile(title, backTitle, backContent,
                                           pageUrl, "tile_173x173.png", "tile_173x173_back.png");
        }
Пример #4
0
        private void Pin_Click(object sender, EventArgs e)
        {
            //selChapterId + ". " + selChapterName + " (" + selEnName + ") " + selType
            //?chapterId=" + bookMark.chapter_id.ToString() + "&chapterName=" + App.ViewModel.ChapterRec.tr_name.ToString() + "&type=" + App.ViewModel.ChapterRec.type + "&enName=" + App.ViewModel.ChapterRec.en_name
            string title       = selChapterId + ". " + selChapterName;
            string backTitle   = selType;
            string backContent = selChapterId + ". " + selEnName;
            string pageUrl     = "/Views/Verses.xaml?chapterId=" + selChapterId.ToString() + "&chapterName=" + selChapterName.ToString() + "&type=" + selType.ToString() + "&enName=" + selEnName;

            LiveTileManager.CreateLiveTile(title, backTitle, backContent,
                                           pageUrl, "tile_173x173.png", "tile_173x173_back.png");
        }
Пример #5
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            LiveTileManager.UpdateTileFromForeground();

            if (App.ViewModel.SettingsViewModel.RestartNeeded)
            {
                App.ViewModel.SettingsViewModel.RestartNeeded = false;
                var msg = AppResources.ResourceManager.GetString("PleaseRestart",
                                                                 AppResources.Culture);
                MessageBox.Show(msg);
                Application.Current.Terminate();
            }
        }
Пример #6
0
        private async void AddToStartMenu_ClickAsync(object sender, RoutedEventArgs e)
        {
            var element = (FrameworkElement)sender;

            if (!(element.DataContext is AccountViewModel account))
            {
                return;
            }
            if (!Mvx.IoCProvider.CanResolve <ICrudServicesAsync>())
            {
                return;
            }

            var liveTileManager = new LiveTileManager(Mvx.IoCProvider.Resolve <ICrudServicesAsync>());

            int  id       = account.Id;
            bool isPinned = SecondaryTile.Exists(id.ToString(CultureInfo.InvariantCulture));

            if (!isPinned)
            {
                SecondaryTile tile = new SecondaryTile(id.ToString(CultureInfo.InvariantCulture), "Money Fox", "a", new Uri("ms-appx:///Assets/SmallTile.scale-150.png"), TileSize.Default);
                tile.VisualElements.ShowNameOnSquare150x150Logo = false;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
                tile.VisualElements.ShowNameOnWide310x150Logo   = false;
                tile.VisualElements.Square310x310Logo           = new Uri("ms-appx:///Assets/Square310x310Logo.scale-100.png");
                tile.VisualElements.Square150x150Logo           = new Uri("ms-appx:///Assets/Square150x150Logo.scale-100.png");
                tile.VisualElements.Wide310x150Logo             = new Uri("ms-appx:///Assets/Wide310x150Logo.scale-100.png");
                tile.VisualElements.Square71x71Logo             = new Uri("ms-appx:///Assets/Square71x71Logo.scale-100.png");
                bool ispinned = await tile.RequestCreateAsync();

                if (ispinned)
                {
                    await liveTileManager.UpdateSecondaryLiveTiles().ConfigureAwait(true);
                }
            }
            else
            {
                await liveTileManager.UpdateSecondaryLiveTiles().ConfigureAwait(true);

                await liveTileManager.UpdatePrimaryLiveTile().ConfigureAwait(true);
            }
        }
Пример #7
0
        private void Logout()
        {
            IsTaskbarVisible = false;
            var messageBox = dialogService.ShowPromptDialog(AppResources.LogoutWarningMessage, AppResources.LogoutPromptMessage, AppResources.LogoutPromptCaption);

            messageBox.Dismissed += (s1, e1) =>
            {
                if (e1.Result == Microsoft.Phone.Controls.CustomMessageBoxResult.LeftButton)
                {
                    IsDataLoaded = false;
                    StorageHelper.ClearUserCredential();
                    cacheService.ClearCache();
                    LiveTileManager.DeleteAllSecondaryTiles();
                    App.IsLoggedIn = false;
                    IsDataLoaded   = true;

                    SimpleIoc.Default.GetInstance <LoginViewModel>().ClearFields();
                    navigationService.Navigate <LoginViewModel>();
                }
                IsTaskbarVisible = true;
            };
        }
Пример #8
0
        private async void AddToStartMenu_ClickAsync(object sender, RoutedEventArgs e)
        {
            var element = (FrameworkElement)sender;

            if (!(element.DataContext is AccountViewModel account))
            {
                return;
            }

            var liveTileManager = new LiveTileManager(ServiceLocator.Current.GetInstance <ICrudServicesAsync>());

            int  id       = account.Id;
            bool isPinned = SecondaryTile.Exists(id.ToString(CultureInfo.InvariantCulture));

            if (!isPinned)
            {
                SecondaryTile tile = new SecondaryTile(id.ToString(CultureInfo.InvariantCulture), Strings.ApplicationTitle, "a", new Uri(SMALL_150_TILE_ICON), TileSize.Default);
                tile.VisualElements.ShowNameOnSquare150x150Logo = false;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
                tile.VisualElements.ShowNameOnWide310x150Logo   = false;
                tile.VisualElements.Square310x310Logo           = new Uri(SQUARE_310_TILE_ICON);
                tile.VisualElements.Square150x150Logo           = new Uri(SQUARE_150_TILE_ICON);
                tile.VisualElements.Wide310x150Logo             = new Uri(WIDE_310_TILE_ICON);
                tile.VisualElements.Square71x71Logo             = new Uri(SQUARE_71_TILE_ICON);
                bool successfulPinned = await tile.RequestCreateAsync();

                if (successfulPinned)
                {
                    await liveTileManager.UpdateSecondaryLiveTiles();
                }
            }
            else
            {
                await liveTileManager.UpdateSecondaryLiveTiles();

                await liveTileManager.UpdatePrimaryLiveTile();
            }
        }
Пример #9
0
 // Code to execute when the application is activated (brought to foreground)
 // This code will not execute when the application is first launched
 private void Application_Activated(object sender, ActivatedEventArgs e)
 {
     //CheckLicense();
     LiveTileManager.UpdateTileFromForeground();
 }
Пример #10
0
 private void Pin_Click(object sender, EventArgs e)
 {
     LiveTileManager.CreateLiveTile("Topics", "Topics in th Quran", "Topics",
                                    "/Views/Topics.xaml", "tile_173x173.png", "tile_173x173_back.png");
 }
Пример #11
0
 private void Pin_Click(object sender, EventArgs e)
 {
     LiveTileManager.CreateLiveTile("Index", "Index of the Quran", "Index",
                                    "/Views/Indexes.xaml", "tile_173x173.png", "tile_173x173_back.png");
 }