public void AddToHistory(SavedLink value) { if (value != null && value.Url != null && value.Url != string.Empty) { var documentTitle0 = ApplicationData.Current.LocalSettings.Values["HistorySavedLinkDocumentTitle0"] as string; var url0 = ApplicationData.Current.LocalSettings.Values["HistorySavedLinkUrl0"] as string; // Only replace if this is a new URL if (value.Url != url0) { // Move slot 1 to 2, 0 to 1 for (int i = 1; i >= 0; i--) { var documentTitle = ApplicationData.Current.LocalSettings.Values["HistorySavedLinkDocumentTitle" + i] as string; var url = ApplicationData.Current.LocalSettings.Values["HistorySavedLinkUrl" + i] as string; ApplicationData.Current.LocalSettings.Values["HistorySavedLinkDocumentTitle" + (i + 1)] = documentTitle; ApplicationData.Current.LocalSettings.Values["HistorySavedLinkUrl" + (i + 1)] = url; } // Replace slot 0 ApplicationData.Current.LocalSettings.Values["HistorySavedLinkDocumentTitle0"] = !string.IsNullOrWhiteSpace(value.DocumentTitle) ? value.DocumentTitle : value.Url; ApplicationData.Current.LocalSettings.Values["HistorySavedLinkUrl0"] = value.Url; } } else { throw new ArgumentException("No null or empty URLs allowed!"); } }
private void HistoryListView_ItemClick(object sender, ItemClickEventArgs e) { SavedLink s = e.ClickedItem as SavedLink; UrlTextBox.Text = s.Url; UrlTextBox.Focus(FocusState.Programmatic); UrlTextBox.SelectionStart = UrlTextBox.Text.Length; }