private static void OpenCmd_Execute(object sender, CommandRunArgs e)
        {
            string str = (string)null;

            if (e.DataItem == null)
            {
                string lastBrowserLocation = Services.RecentFileService.LastBrowserLocation;
                if (Option.IsXP)
                {
                    str = FileChooserDialogModel.GetOpenFilePath(new string[1] {
                        "*.ccs"
                    }, "Open File", false, lastBrowserLocation).FileName;
                    Services.RecentFileService.LastBrowserLocation = Path.GetDirectoryName(str);
                }
                else
                {
                    SelectFileDialog selectFileDialog = new SelectFileDialog();
                    selectFileDialog.Title          = LanguageInfo.Menu_File_OpenProject;
                    selectFileDialog.Action         = FileChooserAction.Open;
                    selectFileDialog.SelectMultiple = false;
                    selectFileDialog.CurrentFolder  = (FilePath)lastBrowserLocation;
                    selectFileDialog.AddFilter("Solution Files", "*.ccs");
                    if (selectFileDialog.Run())
                    {
                        str = (string)selectFileDialog.SelectedFile;
                        Services.RecentFileService.LastBrowserLocation = Path.GetDirectoryName(str);
                    }
                }
            }
            else
            {
                str = e.DataItem.ToString();
            }
            StartInfoService.Instance.HandleOpenSolution(str);
        }
        private void button_Browse_Clicked(object sender, EventArgs e)
        {
            string folder = FileChooserDialogModel.GetBrowseDialogPath("导出路径", false, "", false).Folder;

            if (!string.IsNullOrEmpty(folder))
            {
                this.ExportPath = folder;
            }
            this.buttonOk.GrabFocus();
        }
        private static void SaveAsCmd_Execute(object sender, CommandRunArgs e)
        {
            Services.Workbench.SaveAll();
            Solution selectedSolution = Services.ProjectOperations.CurrentSelectedSolution;
            FilePath itemDirectory    = selectedSolution.ItemDirectory;
            FilePath fileName         = (FilePath)FileChooserDialogModel.GetSaveFilesPath(new string[1] {
                "*.ccs"
            }, LanguageInfo.Dialog_SaveAs, false, (string)selectedSolution.FileName).FileName;
            FilePath filePath = fileName.ParentDirectory.Combine(new string[1]
            {
                fileName.FileNameWithoutExtension
            });

            if (Directory.Exists((string)filePath))
            {
                MessageBox.Show(string.Format(LanguageInfo.MessageBox_Content172, (object)fileName.FileNameWithoutExtension), (Window)null, (string)null, MessageBoxImage.Info);
            }
            else
            {
                try
                {
                    Directory.CreateDirectory((string)filePath);
                    FileService.CopyDirectory((string)selectedSolution.BaseDirectory, (string)filePath);
                    if (selectedSolution.Name != fileName.FileNameWithoutExtension)
                    {
                        string oldName = (string)filePath.Combine(new string[1]
                        {
                            selectedSolution.FileName.FileName
                        });
                        string newName = (string)filePath.Combine(new string[1]
                        {
                            fileName.FileName
                        });
                        FileService.RenameFile(oldName, newName);
                        Services.ProjectsService.ChangeSolutionName(Services.ProgressMonitors.Default, (FilePath)newName, selectedSolution.FileName.FileNameWithoutExtension, fileName.FileNameWithoutExtension);
                    }
                    LogConfig.Output.Error((object)LanguageInfo.Output_SaveAsSucceed);
                }
                catch (Exception ex)
                {
                    LogConfig.Output.Error((object)LanguageInfo.Output_FailedToSaveFile, ex);
                }
            }
        }
        private void SelectFile()
        {
            ResourceFolder resourceFolder = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] array;
            if (this._propertyItem.ResourceFilterDescriptor == null)
            {
                array = new string[]
                {
                    "*.png",
                    "*.jpg"
                };
            }
            else
            {
                array = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
                for (int i = 0; i < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; i++)
                {
                    array[i] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[i];
                }
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(array, LanguageInfo.MessageBox_Content96, false, resourceFolder.FullPath).FileNames;
            if (MonoDevelop.Core.Platform.IsMac)
            {
                base.HasFocus = false;
            }
            if (fileNames != null && fileNames.Count <string>() != 0)
            {
                FilePath       filePath      = fileNames.FirstOrDefault <string>();
                ResourceFolder rootFolder    = Services.ProjectOperations.CurrentResourceGroup.RootFolder;
                string         directoryName = System.IO.Path.GetDirectoryName((this.resourceFile == null) ? resourceFolder.FullPath : this.resourceFile.FullPath);
                resourceFolder = (Services.ProjectOperations.CurrentResourceGroup.FindResourceItem(directoryName) as ResourceFolder);
                if (resourceFolder == null || filePath.IsChildPathOf(rootFolder.BaseDirectory))
                {
                    resourceFolder = rootFolder;
                }
                IProgressMonitor    @default = Services.ProgressMonitors.Default;
                List <ResourceItem> source   = Services.ProjectOperations.MessgeDialogImprotResource(resourceFolder, fileNames);
                ResourceFile        value    = source.FirstOrDefault <ResourceItem>() as ResourceFile;
                this.SetValue(value);
            }
        }
        private void SelectFile()
        {
            ResourceFolder rootFolder1 = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] fileTypes;
            if (this._propertyItem.ResourceFilterDescriptor == null)
            {
                fileTypes = new string[2]
                {
                    "*.png",
                    "*.jpg"
                };
            }
            else
            {
                fileTypes = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
                for (int index = 0; index < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; ++index)
                {
                    fileTypes[index] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[index];
                }
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(fileTypes, LanguageInfo.MessageBox_Content96, false, rootFolder1.FullPath).FileNames;
            if (MonoDevelop.Core.Platform.IsMac)
            {
                this.HasFocus = false;
            }
            if (fileNames == null || ((IEnumerable <string>)fileNames).Count <string>() == 0)
            {
                return;
            }
            FilePath       filePath    = (FilePath)((IEnumerable <string>)fileNames).FirstOrDefault <string>();
            ResourceFolder rootFolder2 = Services.ProjectOperations.CurrentResourceGroup.RootFolder;
            ResourceFolder parent      = Services.ProjectOperations.CurrentResourceGroup.FindResourceItem(Path.GetDirectoryName(this.resourceFile == null ? rootFolder1.FullPath : this.resourceFile.FullPath)) as ResourceFolder;

            if (parent == null || filePath.IsChildPathOf(rootFolder2.BaseDirectory))
            {
                parent = rootFolder2;
            }
            IProgressMonitor progressMonitor = Services.ProgressMonitors.Default;

            this.SetValue(Services.ProjectOperations.MessgeDialogImprotResource(parent, (IEnumerable <string>)fileNames).FirstOrDefault <ResourceItem>() as ResourceFile);
        }
Exemple #6
0
        private void fileButton_Clicked(object sender, EventArgs e)
        {
            ResourceFolder rootFolder = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] array = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
            for (int i = 0; i < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; i++)
            {
                array[i] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[i];
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(array, LanguageInfo.MessageBox_Content96, false, rootFolder.FullPath).FileNames;
            if (fileNames != null && fileNames.Count <string>() != 0)
            {
                List <ResourceItem> source = Services.ProjectOperations.MessgeDialogImprotResource(rootFolder, fileNames);
                ResourceFile        value  = source.FirstOrDefault <ResourceItem>() as ResourceFile;
                this.SetValue(value);
                IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
                if (playControl != null)
                {
                    playControl.Start();
                }
            }
        }
        private void fileButton_Clicked(object sender, EventArgs e)
        {
            ResourceFolder rootFolder = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] fileTypes = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
            for (int index = 0; index < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; ++index)
            {
                fileTypes[index] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[index];
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(fileTypes, LanguageInfo.MessageBox_Content96, false, rootFolder.FullPath).FileNames;
            if (fileNames == null || ((IEnumerable <string>)fileNames).Count <string>() == 0)
            {
                return;
            }
            this.SetValue(Services.ProjectOperations.MessgeDialogImprotResource(rootFolder, (IEnumerable <string>)fileNames).FirstOrDefault <ResourceItem>() as ResourceFile);
            IPlayControl instance = this._propertyItem.Instance as IPlayControl;

            if (instance == null)
            {
                return;
            }
            instance.Start();
        }