Inheritance: EventRegisterEventArgs
Exemplo n.º 1
0
 private void mapManager_InitialiseMapManagerCompleted(object sender, InitialiseMapManagerEventArgs e)
 {
     if (e.IsInitialised)
     {
         _mapManager = sender as IMapManager;
     }
     else
     {
         ErrorMessage = e.ErrorMessage;
     }
     Completed.Set();
 }
Exemplo n.º 2
0
        private void OnInitialiseMapManagerCompleted(object sender, InitialiseMapManagerEventArgs e)
        {
            if (e.IsInitialised)
            {
                ProgressRecord progressRecord = new ProgressRecord(0, "Exporting Glyma Map", string.Format("Initialising {0} export processor", ExportFormat.ToString()));
                progressRecord.SecondsRemaining = -1;
                progressRecord.PercentComplete = 5;
                progressRecord.RecordType = ProgressRecordType.Processing;

                lock (pr_lock)
                {
                    this.ProgressRecord = progressRecord;
                    ProgressEvent.Set(); //notify of change to progress
                }

                ExportUtilityFactory exportFactory = new ExportUtilityFactory(MapManager);
                IExportUtility exportUtil = null;
                switch (MapSchema)
                {
                    case "IBIS":
                        switch (ExportFormat)
                        {
                            case "Compendium":
                                exportUtil = exportFactory.CreateExportUtility(MapType.IBIS, ExportType.Compendium);
                                break;
                            case "Word":
                                exportUtil = exportFactory.CreateExportUtility(MapType.IBIS, ExportType.Word);
                                break;
                            case "PDF":
                                exportUtil = exportFactory.CreateExportUtility(MapType.IBIS, ExportType.PDF);
                                break;
                            case "GlymaXML":
                                //exportUtil = exportFactory.CreateExportUtility(MapType.IBIS, ExportType.GlymaXml);
                                lock (msg_lock)
                                {
                                    Message = "Exporting to GlymaXML format is currently not supported";
                                    LogMessageEvent.Set();
                                }
                                break;
                        }
                        break;
                }
                exportUtil.ExportCompleted += OnExportCompleted;
                exportUtil.ProgressChanged += OnProgressChanged;


                ExportPropertiesDictionary exportProps = CreateExportProperties();
                GlymaExportUserState userState = new GlymaExportUserState(Output);

                progressRecord = new ProgressRecord(0, "Exporting Glyma Map", "Export Progress: 0%");
                progressRecord.SecondsRemaining = -1;
                progressRecord.PercentComplete = 10;
                progressRecord.RecordType = ProgressRecordType.Processing;

                lock (pr_lock)
                {
                    this.ProgressRecord = progressRecord;
                    ProgressEvent.Set(); //notify of change to progress
                }

                exportUtil.ExportMap(Domain, Map, exportProps, null, userState);
                bool signalled = userState.Completed.WaitOne(Timeout.Infinite); //wait for the export to completed
                if (!signalled)
                {
                    Completed.Set(); //since it's inifinite timeout this shouldn't happen
                }
            }
            else
            {
                lock (msg_lock)
                {
                    this.Message = string.Format("Failed to initialise the web service client: {0}", e.ErrorMessage);
                    LogMessageEvent.Set();
                }

                Completed.Set();
            }
        }
Exemplo n.º 3
0
        private void GetAllMapTypesCompleted(object sender, Service.GetAllMapTypesCompletedEventArgs eventArgs)
        {
            if (eventArgs.Error == null)
            {
                ServiceProxy.GetAllMapTypesCompleted -= GetAllMapTypesCompleted;

                TypeManager.AddNodeTypes(eventArgs.Result.NodeTypes.Values);
                TypeManager.AddRelationshipTypes(eventArgs.Result.RelationshipTypes.Values);
                TypeManager.AddConnectionTypes(eventArgs.Result.DescriptorTypes.Values);
                TypeManager.AddMetadataTypes(eventArgs.Result.MetadataTypes.Values);

                IsMapTypesLoaded = true;

                InitialiseMapManagerEventArgs initialisationEventArgs = new InitialiseMapManagerEventArgs(true);

                InitialiseMapManagerCompleted(this, initialisationEventArgs);
            }
            else
            {
                InitialiseMapManagerEventArgs initialisationEventArgs = new InitialiseMapManagerEventArgs(false);

                string errorMsg = eventArgs.Error.ToString();
                if (eventArgs.Error.InnerException != null) 
                {
                    //strip off the TargetInvocationException that wraps the real exception
                    errorMsg = eventArgs.Error.InnerException.ToString();
                }
                initialisationEventArgs.ErrorMessage = errorMsg;
                InitialiseMapManagerCompleted(this, initialisationEventArgs);
            }
        }
Exemplo n.º 4
0
        private void GetGlymaVersionCompleted(object sender, Service.GetApplicationVersionCompletedEventArgs eventArgs)
        {
            if (eventArgs.Error == null)
            {
                ServiceProxy.GetApplicationVersionCompleted -= GetGlymaVersionCompleted;

                Service.GlymaVersion serverVersion = eventArgs.Result;

                if (GlymaClientVersion.RequiresRefresh(serverVersion))
                {
                    InitialiseMapManagerEventArgs initialisationEventArgs = new InitialiseMapManagerEventArgs(false);

                    initialisationEventArgs.ErrorMessage = "The version of Glyma your browser is using is out-of-date. Please clear your browser's cache and refresh your browser to download the latest version of Glyma.";

                    InitialiseMapManagerCompleted(this, initialisationEventArgs);
                }
                else
                {
                    ServiceProxy.GetAllMapTypesCompleted += GetAllMapTypesCompleted;
                    ServiceProxy.GetAllMapTypesAsync(CallingUrl.Url);
                }
            }
            else
            {
                InitialiseMapManagerEventArgs initialisationEventArgs = new InitialiseMapManagerEventArgs(false);

                string errorMsg = eventArgs.Error.ToString();
                if (eventArgs.Error.InnerException != null)
                {
                    //strip off the TargetInvocationException that wraps the real exception
                    errorMsg = eventArgs.Error.InnerException.ToString();
                }
                initialisationEventArgs.ErrorMessage = errorMsg;
                InitialiseMapManagerCompleted(this, initialisationEventArgs);
            }
        }