コード例 #1
0
        private void DeletePendingFiles()
        {
            var    reader = new StreamReader(@"..\..\for_deleting.txt");
            string appDir = ContactsWindow.GetAppDir();

            using (reader)
            {
                var allFiles = reader.ReadToEnd();
                var files    = allFiles.Split(new string[] { Environment.NewLine },
                                              StringSplitOptions.RemoveEmptyEntries);

                try
                {
                    foreach (var file in files)
                    {
                        File.Delete(System.IO.Path.Combine(appDir, @"Pictures\", file));
                    }
                }
                catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.Message); }
                catch (FileNotFoundException ex) { MessageBox.Show(ex.Message); }
                catch (PathTooLongException ex) { MessageBox.Show(ex.Message); }
                catch (IOException ex) { MessageBox.Show(ex.Message); }
            }

            var writer = new StreamWriter(@"..\..\for_deleting.txt", false);

            using (writer)
            {
                writer.WriteLine();
            }
        }
コード例 #2
0
        private void OnShowContactsWindowClick(object sender, RoutedEventArgs e)
        {
            var contacts = new ContactsWindow();

            contacts.Owner = this;
            contacts.ShowDialog();

            this.taskGrid.SelectedItem = null;
            this.Calendar.SelectedDate = null;
        }
コード例 #3
0
        private void OnShowContactsWindowClick(object sender, RoutedEventArgs e)
        {
            var contacts = new ContactsWindow();
            contacts.Owner = this;
            contacts.ShowDialog();

            this.taskGrid.SelectedItem = null;
            this.Calendar.SelectedDate = null;
        }