Beispiel #1
0
        public MainPage()
        {
            InitializeComponent();
            DataTemplate template = new DataTemplate();

            ExampleInAppNotification.ShowDismissButton = true;
            ExampleInAppNotification.Show(myDt, 90000);
        }
Beispiel #2
0
        // ссылка на главу
        private void CopyChapterLink_Click(object sender, RoutedEventArgs e)
        {
            Windows.ApplicationModel.DataTransfer.DataPackage dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage();
            dataPackage.SetText(chapter.Link);
            Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
            var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();

            ExampleInAppNotification.Show(resourceLoader.GetString("LinkIsCopyied"), 4000);
        }
Beispiel #3
0
        private void CopyPageLinkMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            Windows.ApplicationModel.DataTransfer.DataPackage dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage();
            dataPackage.SetText((MangaPages.SelectedItem as Models.Page).image_url);
            Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
            var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();

            ExampleInAppNotification.Show(resourceLoader.GetString("LinkIsCopyied"), 4000);
        }
Beispiel #4
0
        private async void DownloadAsync(object sender, RoutedEventArgs e)
        {
            await Models.Config.DownloadAsync();

            UpdateConfigTextView();
            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

            localSettings.Values.Remove("date_last_update");
            ExampleInAppNotification.Show("Файл конфигурации успешно загружен", 2000);
        }
Beispiel #5
0
 private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
 {
     if (MapHeigh * MapWidth > 2 * NumMine)
     {
         goToPlay();
     }
     else
     {
         int duration = 2000;
         ExampleInAppNotification.Show("Wrong input.", duration);
     }
 }
Beispiel #6
0
 private void MangaPages_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
 {
     if (App.Settings.translate_key.Length == 0)
     {
         var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
         ExampleInAppNotification.Show(resourceLoader.GetString("enter_translate_key"), 4000);
         return;
     }
     TranslateInput.Text      = "";
     TranslateOutput.Text     = "";
     TanslatePanel.Visibility = Visibility.Visible;
 }
Beispiel #7
0
        private async void SaveMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();

            if (await(MangaPages.SelectedItem as Models.Page).Save())
            {
                ExampleInAppNotification.Show(resourceLoader.GetString("image_save"), 4000);
            }
            else
            {
                ExampleInAppNotification.Show(resourceLoader.GetString("image_not_save"), 4000);
            }
        }
Beispiel #8
0
        private async void Load(object sender, RoutedEventArgs e)
        {
            var picker = new Windows.Storage.Pickers.FileOpenPicker();

            picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".json");

            Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                string text = await Windows.Storage.FileIO.ReadTextAsync(file);

                Models.Config.Load(text);
                UpdateConfigTextView();
                ExampleInAppNotification.Show("Файл конфигурации успешно загружен", 2000);
            }
        }
Beispiel #9
0
        private async void Save(object sender, RoutedEventArgs e)
        {
            var savePicker = new Windows.Storage.Pickers.FileSavePicker();

            savePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
            savePicker.FileTypeChoices.Add("Json", new List <string>()
            {
                ".json"
            });
            savePicker.SuggestedFileName = "sites";
            Windows.Storage.StorageFile file = await savePicker.PickSaveFileAsync();

            string res = "[" + String.Join(",", Helpers.Save.Sites.AsStrings().ToArray()) + "]";

            if (file != null)
            {
                await Windows.Storage.FileIO.WriteTextAsync(file, res);

                ExampleInAppNotification.Show("Файл конфигурации успешно сохранен", 2000);
            }
        }
Beispiel #10
0
        // cache
        private void clearCache_Click(object sender, RoutedEventArgs e)
        {
            Ring.IsActive = true;
            var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();

            try
            {
                long     size      = 0;
                string[] filePaths = Directory.GetFiles(ApplicationData.Current.TemporaryFolder.Path);
                foreach (string filePath in filePaths)
                {
                    size += (new System.IO.FileInfo(filePath)).Length;
                    File.Delete(filePath);
                }

                size = size / 1024;
                string sizeText = "";

                if (size > 1024)
                {
                    sizeText = size / 1204 + " Mb";
                }
                else
                {
                    sizeText = size + " Kb";
                }

                ExampleInAppNotification.Show(
                    resourceLoader.GetString("cache_clear") + " " + sizeText,
                    2000
                    );
            }
            catch (Exception ex)
            {
                ExampleInAppNotification.Show(resourceLoader.GetString("cache_clear_error"), 2000);
                System.Diagnostics.Debug.WriteLine("ERROR CLEANING CACHE:" + ex.Message);
            }
            clearCacheComplite.Visibility = Visibility.Visible;
            Ring.IsActive = false;
        }