コード例 #1
0
ファイル: MainWorkSpace.cs プロジェクト: molish/OSDev
        private CommandController commandController; //TODO: добавить реализацию

        public MainWorkSpace()
        {
            securityManager     = SecurityManagerImpl.getInstance();
            dataProvider        = DataPRoviderImpl.getInstance();
            directoryController = DirectoryControllerImpl.getInstance();
            fileController      = FileControllerImpl.getInstance();
            commandController   = CommandControllerImpl.getInstance();
            InitializeComponent();
        }
コード例 #2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            DataProvider        dp = DataPRoviderImpl.getInstance();
            DirectoryController dc = DirectoryControllerImpl.getInstance();
            FileController      fc = FileControllerImpl.getInstance();

            try
            {
                switch (dp.getOperation())
                {
                case Operation.CREATEDIR:
                    dc.createDirectory(textBoxName.Text);
                    break;

                case Operation.CREATEFILE:
                    fc.createFile(textBoxName.Text);
                    break;

                case Operation.RENAMEDIR:
                    dc.renameDirectory(dp.getBuffer(), textBoxName.Text);
                    break;

                case Operation.RENAMEFILE:
                    fc.renameFile(dp.getBuffer(), textBoxName.Text);
                    break;
                }
            }
            catch (WrongFileOrDirectoryNameException ex)
            {
                MessageBox.Show("Неверное имя новой папки!");
            }
            catch (FileOrDirectoryOlreadyExistException ex)
            {
                MessageBox.Show("Такая папка уже существует!");
            }
            finally
            {
                MainWorkSpace mws = (MainWorkSpace)dp.getMainWorkSpace();
                mws.refreshListBox();

                dp.resetBuffer();
                StaticData.MainWorkSpace.Enabled = true;
                this.Close();
            }
        }