private void lb_library_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { LibraryDataList libSelectedItem = (LibraryDataList)lb_library.SelectedItem; int libSelectedItemIndex = lb_library.SelectedIndex; if (libSelectedItem != null && (libSelectedItem.Name != "No Text File" && libSelectedItem.ImagePath != "")) { ApplicationBar.Mode = ApplicationBarMode.Default; } }
void seledtedViewButton_Click(object sender, EventArgs e) { LibraryDataList libSelectedItem = (LibraryDataList)lb_library.SelectedItem; int libSelectedItemIndex = lb_library.SelectedIndex; //MessageBox.Show(libSelectedItemIndex.ToString()); if (libSelectedItemIndex != -1) { NavigationService.Navigate(new Uri("/TextViewPage.xaml?data=" + libSelectedItem.Name, UriKind.Relative)); } }
void seledtedDeleteButton_Click(object sender, EventArgs e) { LibraryDataList libSelectedItem = (LibraryDataList)lb_library.SelectedItem; int libSelectedItemIndex = lb_library.SelectedIndex; //MessageBox.Show(libSelectedItemIndex.ToString()); if (libSelectedItemIndex != -1) { if (MessageBox.Show("Do you want to delete? \n" + libSelectedItem.Name, "Delete File", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } //리스트에서 삭제 _textlists.RemoveAt(libSelectedItemIndex); //저장장소파일 삭제 IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); //StreamReader sr = null; string[] dirs = file.GetDirectoryNames("DownloadFiles"); if (dirs.Length != 0) { String deletefile = "DownloadFiles\\" + libSelectedItem.Name; try { file.DeleteFile(deletefile); } catch (Exception) { return; } } else { //MessageBox.Show("Fail: Delete File"); popupmessage("Delete File error"); } try { //셋팅 지우기 IsolatedStorageSettings.ApplicationSettings[libSelectedItem.Name] = null; IsolatedStorageSettings.ApplicationSettings[libSelectedItem.Name + "readcount"] = null; } catch (KeyNotFoundException) { //없으면 말고 } ApplicationBar.Mode = ApplicationBarMode.Minimized; ReadFileList(); } }