Exemplo n.º 1
0
        private void New_Disk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Instantiate the dialog box
                CreateDiskDialog dlg = new CreateDiskDialog();

                // Configure the dialog box
                dlg.Owner = this;

                // Open the dialog box modally
                dlg.ShowDialog();

                if (dlg.DialogResult == true)
                {
                    Disk dsk = new Disk();
                    dsk.Createdisk(dlg.DiskName, User);
                    dsk.Mountdisk(dlg.DiskName);
                    DiskUserControl duc = new DiskUserControl(this, dsk);
                    DisksWrapPanel.Children.Insert(0, duc);
                }
            }
            catch (Exception exp)
            {
                ErrorHandling.ShowError(exp.Message);
            }
        }
Exemplo n.º 2
0
        private void InitializeDiskList()
        {
            try
            {
                string[] diskPaths = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.disk");

                foreach (string diskPath in diskPaths)
                {
                    Disk dsk = new Disk();
                    dsk.Mountdisk(Path.GetFileNameWithoutExtension(diskPath));
                    DiskUserControl duc = new DiskUserControl(this, dsk);
                    DisksWrapPanel.Children.Insert(0, duc);
                }
            }
            catch (Exception exp)
            {
                ErrorHandling.ShowError(exp.Message);
                this.Close();
            }
        }