예제 #1
0
 public void RemoveModule(dnModule module)
 {
     if (treeView.InvokeRequired)
     {
         treeView.Invoke(new Action <dnModule>(RemoveModule), module);
     }
     if (module.ModuleDef != null)
     {
         if (!resolver.RemoveModuleDef(module.ModuleDef))
         {
             return;
         }
     }
     foreach (DataTreeNodeX node in treeView.Nodes)
     {
         if (node != null && node.Model is dnModuleModel)
         {
             var nodeModule = ((dnModuleModel)node.Model).Module;
             if (nodeModule == module)
             {
                 treeView.Nodes.Remove(node);
                 OnNodeSelected(treeView, new TreeViewEventArgs(treeView.SelectedNode));
             }
         }
     }
 }
예제 #2
0
        public Task LoadModule(string path)
        {
            if (treeView.InvokeRequired)
            {
                return((Task)treeView.Invoke(new Func <string, Task>(LoadModule), path));
            }

            return(Task.Factory.StartNew(() => {
                var module = new dnModule(path, new ModuleContext(resolver));
                if (module.ModuleDef != null)
                {
                    ModuleDefMD cached;
                    if (!resolver.AddModuleDef(module.ModuleDef, out cached))
                    {
                        return null;
                    }
                }
                return module;
            }).ContinueWith(task => {
                if (task.Result != null)
                {
                    treeView.Nodes.Add(new dnModuleModel(task.Result).ToNode());
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()));
        }
예제 #3
0
		public Task LoadModule(string path) {
			if (treeView.InvokeRequired) {
				return (Task)treeView.Invoke(new Func<string, Task>(LoadModule), path);
			}

			return Task.Factory.StartNew(() => {
				var module = new dnModule(path, new ModuleContext(resolver));
				if (module.ModuleDef != null) {
					ModuleDefMD cached;
					if (!resolver.AddModuleDef(module.ModuleDef, out cached))
						return null;
				}
				return module;
			}).ContinueWith(task => {
				if (task.Result != null)
					treeView.Nodes.Add(new dnModuleModel(task.Result).ToNode());
			}, TaskScheduler.FromCurrentSynchronizationContext());
		}
예제 #4
0
		public void RemoveModule(dnModule module) {
			if (treeView.InvokeRequired) {
				treeView.Invoke(new Action<dnModule>(RemoveModule), module);
			}
			if (module.ModuleDef != null) {
				if (!resolver.RemoveModuleDef(module.ModuleDef))
					return;
			}
			foreach (DataTreeNodeX node in treeView.Nodes) {
				if (node != null && node.Model is dnModuleModel) {
					var nodeModule = ((dnModuleModel)node.Model).Module;
					if (nodeModule == module) {
						treeView.Nodes.Remove(node);
						OnNodeSelected(treeView, new TreeViewEventArgs(treeView.SelectedNode));
					}
				}
			}
		}
예제 #5
0
 public ExportForm(dnModule module)
 {
     Module = module;
     Text   = "Export " + module.Name;
     Initialize();
 }