async private void buttonFavorite_Tapped(object sender, TappedRoutedEventArgs e)
        {
            this.dlg1.Title = "お気に入りの登録";
            dlgText.Text    = "お気に入りの登録を行いますか?";
            var result = await this.dlg1.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                String filePath = "FavoriteData.csv";

                // write file
                StorageFolder roamingFolder = ApplicationData.Current.RoamingFolder;
                StorageFile   file          = await roamingFolder.CreateFileAsync(filePath,
                                                                                  CreationCollisionOption.OpenIfExists);

                await FileIO.AppendTextAsync(file, (string)webView1.DocumentTitle + "\t" + URIBlock.Text + "\t" + DateTime.Now + "\n");

                // PopulateFavorites();
                var s2 = new Logic.PopulateFavorites();
                s2.populateFavorites();
            }
            else if (result == ContentDialogResult.Secondary)
            {
            }
            else
            {
            }
        }
Beispiel #2
0
        private void pageRoot_Loaded(object sender, RoutedEventArgs e)
        {
            s1.populateHistories();

            var p1 = new Logic.HistoryDataStore(ref histories);

            cvs1.Source = histories;

            //var s2 = new Logic.PopulateFavorites();
            s2.populateFavorites();

            var p2 = new Logic.FavoriteDataStore(ref favorites_load);

            cvs2.Source = favorites_load;
        }
        /// <summary>
        /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを
        /// 再作成する場合は、保存状態も指定されます。
        /// </summary>
        /// <param name="sender">
        /// イベントのソース (通常、<see cref="NavigationHelper"/>)>
        /// </param>
        /// <param name="e">このページが最初に要求されたときに
        /// <see cref="Frame.Navigate(Type, Object)"/> に渡されたナビゲーション パラメーターと、
        /// 前のセッションでこのページによって保存された状態の辞書を提供する
        /// セッション。ページに初めてアクセスするとき、状態は null になります。</param>
        async private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var p1 = new Logic.HistoryDataStore(ref histories);

            cvs1.Source = histories;

            var s2 = new Logic.PopulateFavorites();

            s2.populateFavorites();

            var s1 = new Logic.PopulateHistories();

            s1.populateHistories();

            var p2 = new Logic.FavoriteDataStore(ref favorites_load);

            cvs2.Source = favorites_load;

            if (e.NavigationParameter != null)
            {
                string msg = e.NavigationParameter.ToString();

                string[] msg2 = msg.Split('\n');

                if (UrlBox.Text == "")
                {
                    try
                    {
                        UrlBox.Text = msg2[1];
                    }
                    catch
                    {
                        string URL = "";
                        Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                        try
                        {
                            UrlBox.Text = (string)roamingSettings.Values["exampleSetting"];
                        }
                        catch (Exception ex)
                        {
                            UrlBox.Text = "http://yahoo.co.jp/";
                        }
                        //UrlBox.Text = URL;
                        //UrlBox.Text = "";
                    }
                    await NavigateAsync();
                }
            }

            else
            {
                if (UrlBox.Text == "")
                {
                    Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                    try
                    {
                        UrlBox.Text = (string)roamingSettings.Values["exampleSetting"];
                    }
                    catch (Exception ex)
                    {
                        UrlBox.Text = "http://yahoo.co.jp/";
                    }
                    await NavigateAsync();
                }
            }
        }