示例#1
0
        private void btnReWrite_Click(object sender, RoutedEventArgs e)
        {
            int    SelectedFilePos = 0;
            MyFile SelectedFile    = listView1.SelectedItem as MyFile;

            for (int i = 0; i < MyFiles.Count; i++)
            {
                if (MyFiles[i] == SelectedFile)
                {
                    SelectedFilePos = i;
                }
            }

            Window2 ReWriteWindow = new Window2(MyFiles, SelectedFilePos);

            ReWriteWindow.Title = "RewriteFile";
            ReWriteWindow.Show();
        }
示例#2
0
        private void btnSearchDone_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            bool   IfThereIsSuchFile = false;
            MyFile searchfile        = new MyFile
            {
                MyFileName = textBox1.Text,
                MyFileType = textBox2.Text,
                MyFileData = textBox4.Text,
                MyFilePath = textBox3.Text,
            };

            foreach (var eachfile in MyFiles)
            {
                if (searchfile.Matches(eachfile))
                {
                    IfThereIsSuchFile = true;
                    int SelectedFilePos = 0;
                    for (int i = 0; i < MyFiles.Count; i++)
                    {
                        if (MyFiles[i] == eachfile)
                        {
                            SelectedFilePos = i;
                        }
                    }
                    Window2 ReWriteWindow = new Window2(MyFiles, SelectedFilePos);
                    ReWriteWindow.Title = "Search Result";
                    ReWriteWindow.Show();
                }
            }
            if (!IfThereIsSuchFile)
            {
                Window3 WarningWindow = new Window3(MyFiles, searchfile);
                WarningWindow.Title = "No Such File";
                WarningWindow.Show();
            }
        }