Ejemplo n.º 1
0
 public LoadingOperation(GATDataAllocationMode allocationMode, int numFiles, FileLoadedHandler handler, bool forceMono = false)
 {
     _allocationMode = allocationMode;
     _paths          = new Queue <string>(numFiles);
     Status          = LoadOperationStatus.Configuring;
     OnFileWasLoaded = handler;
     _forceMono      = forceMono;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Warning: does not check for unsaved changes. Use OpenProject() if you need to.
        /// </summary>
        /// <param name="fileName"></param>
        private void OpenProject(string fileName, FileLoadedHandler OnLoaded)
        {
            try
            {
                if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
                {
                    listPluginsAlreadyInitialized.Clear();

                    var ext = new FileInfo(fileName).Extension;
                    if (ext.Length < 2)
                    {
                        return;
                    }

                    ext = ext.Remove(0, 1);
                    if (ComponentInformations.EditorExtension.ContainsKey(ext))
                    {
                        Type editorType = ComponentInformations.EditorExtension[ext];

                        var editor = AddEditorDispatched(editorType);
                        if (editor == null)
                        {
                            return;
                        }

                        if (OnLoaded != null)
                        {
                            editor.OnFileLoaded += OnLoaded;
                            editor.OnFileLoaded += delegate { editor.OnFileLoaded -= OnLoaded; };
                        }

                        editor.Open(fileName);
                        if (editor.Presentation != null)
                        {
                            editor.Presentation.ToolTip = fileName;
                        }

                        SetCurrentEditorAsDefaultEditor();
                        this.ProjectFileName = fileName;

                        recentFileList.AddRecentFile(fileName);
                    }
                }
                else
                {
                    MessageBox.Show(string.Format(Properties.Resources.File__0__doesn_t_exist_, fileName), Properties.Resources.Error_loading_file);
                    recentFileList.RemoveFile(fileName);
                }
            }
            catch (Exception ex)
            {
                GuiLogMessage(string.Format("Couldn't open project file {0}:{1}", fileName, ex.Message), NotificationLevel.Error);
            }
        }
Ejemplo n.º 3
0
 public LoadingOperation( GATDataAllocationMode allocationMode, int numFiles, FileLoadedHandler handler, bool forceMono = false )
 {
     _allocationMode 	= allocationMode;
     _paths 				= new Queue< string >( numFiles );
     Status 				= LoadOperationStatus.Configuring;
     OnFileWasLoaded 	= handler;
     _forceMono 			= forceMono;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets a LoadingOperation object to which 
 /// you may add files and callbacks. To start 
 /// the operation, call EnqueueOperation.
 /// </summary>
 public AGATLoadingOperation NewOperation( int numFilesToLoad, GATDataAllocationMode allocationMode, FileLoadedHandler onFileWasLoaded, bool forceMono = false )
 {
     return new LoadingOperation( allocationMode, numFilesToLoad, onFileWasLoaded, forceMono ) as AGATLoadingOperation;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets a LoadingOperation object to which
 /// you may add files and callbacks. To start
 /// the operation, call EnqueueOperation.
 /// </summary>
 public AGATLoadingOperation NewOperation(int numFilesToLoad, GATDataAllocationMode allocationMode, FileLoadedHandler onFileWasLoaded, bool forceMono = false)
 {
     return(new LoadingOperation(allocationMode, numFilesToLoad, onFileWasLoaded, forceMono) as AGATLoadingOperation);
 }