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; }
async void webView1_ContentLoading(WebView sender, WebViewContentLoadingEventArgs args) { string url = (args.Uri != null) ? args.Uri.ToString() : "<null>"; String filePath = "HistoryData.csv"; //String filePath2 = "LastViewData.csv"; // write file StorageFolder roamingFolder = ApplicationData.Current.RoamingFolder; StorageFile file = await roamingFolder.CreateFileAsync(filePath, CreationCollisionOption.OpenIfExists); // StorageFile file2 = await roamingFolder.CreateFileAsync(filePath2, // CreationCollisionOption.OpenIfExists); try { await FileIO.AppendTextAsync(file, (string)webView1.DocumentTitle + "\t" + url + "\t" + DateTime.Now + "\n"); // await FileIO.AppendTextAsync(file, (string)webView1.DocumentTitle + "\t" + url + "\t" + DateTime.Now + "\n"); } catch (Exception ex) { } var s1 = new Logic.PopulateHistories(); s1.populateHistories(); var p1 = new Logic.HistoryDataStore(ref histories); cvs1.Source = histories; var p2 = new Logic.FavoriteDataStore(ref favorites_load); cvs2.Source = favorites_load; var s2 = new Logic.PopulateLastview(); s2.populateLastview(); }
/// <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(); } } }