Ejemplo n.º 1
0
        //Змінити ім'я файлу або папки
        private void button7_Click(object sender, EventArgs e)
        {
            Subject test = new Subject("Change");

            test.AddObserver(MainObs);

            if (listView1.SelectedIndices.Count != 0)
            {
                int selectedIndex = listView1.SelectedIndices[0];

                string pathToObj = listView1.Items[selectedIndex].SubItems[0].Text,
                       extens    = listView1.Items[selectedIndex].SubItems[2].Text;

                bool isDisk = false;

                if (extens == @"Диск")
                {
                    isDisk = true;
                }

                if (isDisk)
                {
                    test.NotifyObservers("return message: Can't rename root-directory");
                }
                else
                {
                    RenameObject form = new RenameObject(pathToObj, extens);
                    form.Owner = this;
                    form.Show();

                    test.NotifyObservers("return message : Request processing by another form");
                    richTextBox1.Text = MainObs.GetLog();
                }
            }
        }
Ejemplo n.º 2
0
 protected virtual void onRename()
 {
     if (RenameObject != null)
     {
         RenameObject.Invoke();
     }
 }