Ejemplo n.º 1
0
        public void NewFileResult(String filePath)
        {
            mw.RemoveDialog();
            String _filePath = needControlBaseUserControl.GetFileDirectory();

            _filePath += filePath;
            if (File.Exists(_filePath))
            {
                new MessageDialog(mw, "ExistingSameNameFile").ShowDialog();
                return;
            }
            else
            {
                File.Move(mw.LastProjectPath + needControlBaseUserControl._fileType + @"\" + needControlBaseUserControl.filePath
                          , mw.LastProjectPath + needControlBaseUserControl._fileType + @"\" + filePath);
                needControlListBoxItem.Header       = filePath;
                needControlBaseUserControl.filePath = filePath;
            }
        }
Ejemplo n.º 2
0
        public bool GotoFile(String fileName)
        {
            BaseUserControl baseUserControl = GetNeedControlBaseUserControl(fileName);
            String          _filePath       = baseUserControl.GetFileDirectory() + fileName;

            ProcessStartInfo psi;

            psi = new ProcessStartInfo("Explorer.exe")
            {
                Arguments = "/e,/select," + _filePath
            };
            Process.Start(psi);
            return(true);
        }
Ejemplo n.º 3
0
        private void GoToFile(object sender, RoutedEventArgs e)
        {
            GetNeedControl(sender);
            BaseUserControl baseUserControl = null;

            if (!needControlFileName.EndsWith(".lightScript"))
            {
                if (needControlFileName.EndsWith(".mid"))
                {
                    baseUserControl = userControls[0];
                }
                else
                {
                    for (int i = 0; i < userControls.Count; i++)
                    {
                        if (needControlFileName.EndsWith(userControls[i]._fileExtension))
                        {
                            baseUserControl = userControls[i];
                            break;
                        }
                    }
                }
            }
            else
            {
                baseUserControl = userControls[3] as BaseUserControl;
            }

            if (baseUserControl == null)
            {
                return;
            }
            needControlBaseUserControl = baseUserControl;

            baseUserControl.filePath = needControlFileName;

            String _filePath = baseUserControl.GetFileDirectory() + baseUserControl.filePath;

            Console.WriteLine(_filePath);

            ProcessStartInfo psi;

            psi = new ProcessStartInfo("Explorer.exe")
            {
                Arguments = "/e,/select," + _filePath
            };
            Process.Start(psi);
        }
Ejemplo n.º 4
0
        public bool CheckFile(String oldFileName, String fileName, out BaseUserControl baseUserControl)
        {
            baseUserControl = GetNeedControlBaseUserControl(fileName);
            if (baseUserControl == null)
            {
                return(false);
            }

            String _filePath = baseUserControl.GetFileDirectory();

            _filePath = _filePath + fileName;
            if (File.Exists(_filePath))
            {
                new MessageDialog(mw, "ExistingSameNameFile").ShowDialog();
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 5
0
        private void RenameFileName(object sender, RoutedEventArgs e)
        {
            GetNeedControl(sender);
            BaseUserControl baseUserControl = null;

            if (!needControlFileName.EndsWith(".lightScript"))
            {
                for (int i = 0; i < mw.editUserControl.userControls.Count; i++)
                {
                    if (needControlFileName.EndsWith(mw.editUserControl.userControls[i]._fileExtension))
                    {
                        baseUserControl = mw.editUserControl.userControls[i];
                        break;
                    }
                }
            }
            else
            {
                baseUserControl = mw.editUserControl.userControls[3] as BaseUserControl;
            }

            if (baseUserControl == null)
            {
                return;
            }
            needControlBaseUserControl = baseUserControl;

            baseUserControl.filePath = needControlFileName;

            String _filePath = baseUserControl.GetFileDirectory();

            UserControlDialog.NewFileDialog newFileDialog = new UserControlDialog.NewFileDialog(mw, true, baseUserControl._fileExtension, FileBusiness.CreateInstance().GetFilesName(baseUserControl.filePath, new List <string>()
            {
                baseUserControl._fileExtension
            }), baseUserControl._fileExtension, "", NewFileResult);
            mw.ShowMakerDialog(newFileDialog);
        }
Ejemplo n.º 6
0
        private void LoadFileList()
        {
            lbMain.Items.Clear();
            BaseUserControl baseUserControl = gMain.Children[0] as BaseUserControl;
            List <String>   fileNames       = FileBusiness.CreateInstance().GetFilesName(baseUserControl.GetFileDirectory(), new List <string>()
            {
                baseUserControl._fileExtension
            });

            for (int i = 0; i < fileNames.Count; i++)
            {
                lbMain.Items.Add(fileNames[i]);
            }
        }