当前位置: 首页>>代码示例>>C#>>正文


C# PluginCore.DataEvent类代码示例

本文整理汇总了C#中PluginCore.DataEvent的典型用法代码示例。如果您正苦于以下问题:C# DataEvent类的具体用法?C# DataEvent怎么用?C# DataEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataEvent类属于PluginCore命名空间,在下文中一共展示了DataEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreSession

 public static void RestoreSession(String file, Session session)
 {
     try
     {
         Globals.MainForm.RestoringContents = true;
         Globals.MainForm.CloseAllDocuments(false);
         if (!Globals.MainForm.CloseAllCanceled)
         {
             DataEvent te = new DataEvent(EventType.RestoreSession, file, session);
             EventManager.DispatchEvent(Globals.MainForm, te);
             if (!te.Handled)
             {
                 for (Int32 i = 0; i < session.Files.Count; i++)
                 {
                     String fileToOpen = session.Files[i];
                     if (File.Exists(fileToOpen)) Globals.MainForm.OpenEditableDocument(fileToOpen);
                 }
                 if (Globals.MainForm.Documents.Length == 0)
                 {
                     NotifyEvent ne = new NotifyEvent(EventType.FileEmpty);
                     EventManager.DispatchEvent(Globals.MainForm, ne);
                     if (!ne.Handled) Globals.MainForm.New(null, null);
                 }
                 DocumentManager.ActivateDocument(session.Index);
             }
         }
         Globals.MainForm.RestoringContents = false;
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:33,代码来源:SessionManager.cs

示例2: DoProcess

 /// <summary>
 /// Processes the specified document
 /// </summary>
 private void DoProcess(ITabbedDocument document)
 {
     switch (this.operationComboBox.SelectedIndex)
     {
         case 0: // Format Code
         {
             DataEvent de = new DataEvent(EventType.Command, "CodeFormatter.FormatDocument", document);
             EventManager.DispatchEvent(this, de);
             break;
         }
         case 1: // Organize Imports
         {
             OrganizeImports command = new OrganizeImports();
             command.SciControl = document.SciControl;
             command.Execute();
             break;
         }
         case 2: // Truncate Imports
         {
             OrganizeImports command = new OrganizeImports();
             command.SciControl = document.SciControl;
             command.TruncateImports = true;
             command.Execute();
             break;
         }
         case 3: // Consistent EOLs
         {
             document.SciControl.ConvertEOLs(document.SciControl.EOLMode);
             break;
         }
     }
 }
开发者ID:xeronith,项目名称:flashdevelop,代码行数:35,代码来源:BatchProcessDialog.cs

示例3: CreateProject

		/// <summary>
		/// Creates a new project based on the specified template directory.
		/// </summary>
		public Project CreateProject(string templateDirectory, string projectLocation, string projectName, string packageName)
		{
            isRunning = true;
            if (!projectTypesSet) SetInitialProjectHash();
			this.projectName = projectName;
            this.packageName = packageName;
            projectId = Regex.Replace(Project.RemoveDiacritics(projectName), "[^a-z0-9]", "", RegexOptions.IgnoreCase);
            packagePath = packageName.Replace('.', '\\');
            if (packageName.Length > 0)
            {
                packageDot = packageName + ".";
                packageSlash = packagePath + "\\";
            }
            string projectTemplate = FindProjectTemplate(templateDirectory);
            string projectPath = Path.Combine(projectLocation, projectName + Path.GetExtension(projectTemplate));
            projectPath = PathHelper.GetPhysicalPathName(projectPath);
            // notify & let a plugin handle project creation
            Hashtable para = new Hashtable();
            para["template"] = projectTemplate;
            para["location"] = projectLocation;
            para["project"] = projectPath;
            para["id"] = projectId;
            para["package"] = packageName;
            DataEvent de = new DataEvent(EventType.Command, ProjectManagerEvents.CreateProject, para);
            EventManager.DispatchEvent(this, de);
            if (!de.Handled)
            {
                int addArgs = 1;
                arguments = new Argument[PluginBase.MainForm.Settings.CustomArguments.Count + addArgs];
                arguments[0] = new Argument("FlexSDK", PluginBase.MainForm.ProcessArgString("$(FlexSDK)"));
                PluginBase.MainForm.Settings.CustomArguments.CopyTo(arguments, addArgs);
                Directory.CreateDirectory(projectLocation);
                // manually copy important files
                CopyFile(projectTemplate, projectPath);
                CopyProjectFiles(templateDirectory, projectLocation, true);
            }
            isRunning = false;
            if (File.Exists(projectPath))
            {
                projectPath = PathHelper.GetPhysicalPathName(projectPath);
                de = new DataEvent(EventType.Command, ProjectManagerEvents.ProjectCreated, para);
                EventManager.DispatchEvent(this, de);
                return ProjectLoader.Load(projectPath);
            }
            else return null;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:49,代码来源:ProjectCreator.cs

示例4: ApplyAllShortcuts

 /// <summary>
 /// Applies all shortcuts to the items
 /// </summary>
 public static void ApplyAllShortcuts()
 {
     ShortcutManager.UpdateAllShortcuts();
     foreach (ShortcutItem item in RegistedItems)
     {
         if (item.Item != null)
         {
             item.Item.ShortcutKeys = Keys.None;
             item.Item.ShortcutKeys = item.Custom;
         }
         else if (item.Default != item.Custom)
         {
             DataEvent de = new DataEvent(EventType.Shortcut, item.Id, item.Custom);
             EventManager.DispatchEvent(Globals.MainForm, de);
         }
     }
 }
开发者ID:Neverbirth,项目名称:flashdevelop,代码行数:20,代码来源:ShortcutManager.cs

示例5: CreateProject

 /// <summary>
 /// Creates a new project based on the specified template directory.
 /// </summary>
 public Project CreateProject(string templateDirectory, string projectLocation, string projectName, string packageName)
 {
     isRunning = true;
     if (!projectTypesSet) SetInitialProjectHash();
     SetContext(projectName, packageName);
     string projectTemplate = FindProjectTemplate(templateDirectory);
     string projectPath = Path.Combine(projectLocation, projectName + Path.GetExtension(projectTemplate));
     projectPath = PathHelper.GetPhysicalPathName(projectPath);
     // notify & let a plugin handle project creation
     Hashtable para = new Hashtable();
     para["template"] = projectTemplate;
     para["location"] = projectLocation;
     para["project"] = projectPath;
     para["id"] = projectId;
     para["package"] = packageName;
     DataEvent de = new DataEvent(EventType.Command, ProjectManagerEvents.CreateProject, para);
     EventManager.DispatchEvent(this, de);
     if (!de.Handled)
     {
         Directory.CreateDirectory(projectLocation);
         // manually copy important files
         CopyFile(projectTemplate, projectPath);
         CopyProjectFiles(templateDirectory, projectLocation, true);
     }
     isRunning = false;
     if (File.Exists(projectPath))
     {
         projectPath = PathHelper.GetPhysicalPathName(projectPath);
         de = new DataEvent(EventType.Command, ProjectManagerEvents.ProjectCreated, para);
         EventManager.DispatchEvent(this, de);
         try
         {
             return ProjectLoader.Load(projectPath);
         }
         catch (Exception ex)
         {
             TraceManager.Add(ex.Message);
             return null;
         }
     }
     else return null;
 }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:45,代码来源:ProjectCreator.cs

示例6: Start

 public static bool Start(string projectPath, string flex2Path, DataEvent message)
 {
     if (ignoreMessage) return false;
     try
     {
         if (debugger != null) debugger.Cleanup();
         startMessage = message;
         debugger = new FdbWrapper();
         debugger.OnStarted += new LineEvent(debugger_OnStarted);
         debugger.OnTrace += new LineEvent(debugger_OnTrace);
         debugger.OnError += new LineEvent(debugger_OnError);
         if (PluginMain.Settings.VerboseFDB)
             debugger.OnOutput += new LineEvent(debugger_OnOutput);
         debugger.Run(projectPath, flex2Path);
         TraceManager.AddAsync(TextHelper.GetString("Info.CapturingTracesWithFDB"));
         return true;
     }
     catch
     {
         TraceManager.AddAsync(TextHelper.GetString("Info.FailedToLaunchFBD"), 3);
     }
     return false;
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:23,代码来源:FlexDebugger.cs

示例7: GetGlobalClasspaths

 public List<string> GetGlobalClasspaths(String lang)
 {
     List<String> cp = null;
     Hashtable info = new Hashtable();
     info["language"] = lang;
     DataEvent de = new DataEvent(EventType.Command, "ASCompletion.GetUserClasspath", info);
     EventManager.DispatchEvent(this, de);
     if (de.Handled && info.ContainsKey("cp")) cp = info["cp"] as List<string>;
     return cp ?? new List<string>();
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:10,代码来源:Settings.cs

示例8: SetGlobalClasspaths

 public void SetGlobalClasspaths(String lang, List<String> classpaths)
 {
     Hashtable info = new Hashtable();
     info["language"] = lang;
     info["cp"] = classpaths;
     DataEvent de = new DataEvent(EventType.Command, "ASCompletion.SetUserClasspath", info);
     EventManager.DispatchEvent(this, de);
     FireChanged("GlobalClasspath");
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:9,代码来源:Settings.cs

示例9: Save

 /// <summary>
 /// Saves an editable document
 /// </summary>
 public void Save(String file)
 {
     if (!this.IsEditable) return;
     if (!this.IsUntitled && FileHelper.FileIsReadOnly(this.FileName))
     {
         String dlgTitle = TextHelper.GetString("Title.ConfirmDialog");
         String message = TextHelper.GetString("Info.MakeReadOnlyWritable");
         if (MessageBox.Show(Globals.MainForm, message, dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             ScintillaManager.MakeFileWritable(this.SciControl);
         }
         else return;
     }
     String oldFile = this.SciControl.FileName;
     Boolean otherFile = (this.SciControl.FileName != file);
     if (otherFile)
     {
         String args = this.FileName + ";" + file;
         RecoveryManager.RemoveTemporaryFile(this.FileName);
         TextEvent renaming = new TextEvent(EventType.FileRenaming, args);
         EventManager.DispatchEvent(this, renaming);
         TextEvent close = new TextEvent(EventType.FileClose, this.FileName);
         EventManager.DispatchEvent(this, close);
     }
     TextEvent saving = new TextEvent(EventType.FileSaving, file);
     EventManager.DispatchEvent(this, saving);
     if (!saving.Handled)
     {
         this.UpdateDocumentIcon(file);
         this.SciControl.FileName = file;
         ScintillaManager.CleanUpCode(this.SciControl);
         DataEvent de = new DataEvent(EventType.FileEncode, file, this.SciControl.Text);
         EventManager.DispatchEvent(this, de); // Lets ask if a plugin wants to encode and save the data..
         if (!de.Handled) FileHelper.WriteFile(file, this.SciControl.Text, this.SciControl.Encoding, this.SciControl.SaveBOM);
         this.IsModified = false;
         this.SciControl.SetSavePoint();
         RecoveryManager.RemoveTemporaryFile(this.FileName);
         this.fileInfo = new FileInfo(this.FileName);
         if (otherFile)
         {
             ScintillaManager.UpdateControlSyntax(this.SciControl);
             Globals.MainForm.OnFileSave(this, oldFile);
         }
         else Globals.MainForm.OnFileSave(this, null);
     }
     this.RefreshTexts();
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:50,代码来源:TabbedDocument.cs

示例10: NotifyDisposed

 private void NotifyDisposed(String file)
 {
     DataEvent de = new DataEvent(EventType.Command, "FlashViewer.Closed", file);
     EventManager.DispatchEvent(this, de);
 }
开发者ID:Dsnoi,项目名称:flashdevelopjp,代码行数:5,代码来源:PluginMain.cs

示例11: HandleCommand

 /// <summary>
 /// Handles the Command event and displays the movie
 /// </summary>
 public void HandleCommand(DataEvent evnt)
 {
     try
     {
         if (evnt.Action.StartsWith("PanelFlashViewer."))
         {
             String action = evnt.Action;
             String[] args = evnt.Data.ToString().Split(',');
             switch (action)
             {
                 case "PanelFlashViewer.Panel":
                     this.pluginPanel.Show();
                     this.pluginUI.OpenSWF(args[0]);
                     break;
             }
             evnt.Handled = true;
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
开发者ID:Dsnoi,项目名称:flashdevelopjp,代码行数:26,代码来源:PluginMain.cs

示例12: InsertColor

		/**
		* Inserts a color to the editor
		*/
		public void InsertColor(object sender, System.EventArgs e)
		{
			try
			{
	    		ScintillaControl sci = this.CurSciControl;
	    		if (this.colorDialog.ShowDialog(this) == DialogResult.OK)
	    		{
					DataEvent de = new DataEvent(EventType.CustomData, "FlashDevelop.InsertColor", this.colorDialog.Color);
					Global.Plugins.NotifyPlugins(this, de);
					//
					if (!de.Handled)
					{
						int position = this.CurSciControl.CurrentPos;
						string colorText = SharedUtils.ColorToHex(this.colorDialog.Color);
						if (sci.ConfigurationLanguage != "xml" && sci.ConfigurationLanguage != "html")
		    			{
		    				colorText = Regex.Replace(colorText, "#", "0x");
		    			}
		    			sci.ReplaceSel(colorText);
					}
	    		}
			}
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while inserting color.", ex);
			}
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:30,代码来源:MainForm.cs

示例13: ConvertToConst

        private static void ConvertToConst(ClassModel inClass, ScintillaNet.ScintillaControl Sci, MemberModel member, bool detach)
        {
            String suggestion = "NEW_CONST";
            String label = TextHelper.GetString("ASCompletion.Label.ConstName");
            String title = TextHelper.GetString("ASCompletion.Title.ConvertToConst");

            Hashtable info = new Hashtable();
            info["suggestion"] = suggestion;
            info["label"] = label;
            info["title"] = title;
            DataEvent de = new DataEvent(EventType.Command, "ProjectManager.LineEntryDialog", info);
            EventManager.DispatchEvent(null, de);
            if (!de.Handled)
                return;
            
            suggestion = (string)info["suggestion"];

            int position = Sci.CurrentPos;
            MemberModel latest = null;

            int wordPosEnd = Sci.WordEndPosition(position, true);
            int wordPosStart = Sci.WordStartPosition(position, true);
            char cr = (char)Sci.CharAt(wordPosEnd);
            if (cr == '.')
            {
                wordPosEnd = Sci.WordEndPosition(wordPosEnd + 1, true);
            }
            else
            {
                cr = (char)Sci.CharAt(wordPosStart - 1);
                if (cr == '.')
                {
                    wordPosStart = Sci.WordStartPosition(wordPosStart - 1, true);
                }
            }
            Sci.SetSel(wordPosStart, wordPosEnd);
            string word = Sci.SelText;
            Sci.ReplaceSel(suggestion);
            
            if (member == null)
            {
                detach = false;
                lookupPosition = -1;
                position = Sci.WordStartPosition(Sci.CurrentPos, true);
                Sci.SetSel(position, Sci.WordEndPosition(position, true));
            }
            else
            {
                latest = GetLatestMemberForVariable(GeneratorJobType.Constant, inClass, 
                    Visibility.Private, new MemberModel("", "", FlagType.Static, 0));
                if (latest != null)
                {
                    position = FindNewVarPosition(Sci, inClass, latest);
                }
                else
                {
                    position = GetBodyStart(inClass.LineFrom, inClass.LineTo, Sci);
                    detach = false;
                }
                if (position <= 0) return;
                Sci.SetSel(position, position);
            }

            MemberModel m = NewMember(suggestion, member, FlagType.Variable | FlagType.Constant | FlagType.Static);
            m.Type = ASContext.Context.Features.numberKey;
            m.Value = word;
            GenerateVariable(m, position, detach);
        }
开发者ID:zaynyatyi,项目名称:flashdevelop,代码行数:68,代码来源:ASGenerator.cs

示例14: CodeGeneratorMenuItemClicked

 /// <summary>
 /// Invokes the ASCompletion contextual generator
 /// </summary>
 private void CodeGeneratorMenuItemClicked(Object sender, EventArgs e)
 {
     DataEvent de = new DataEvent(EventType.Command, "ASCompletion.ContextualGenerator", null);
     EventManager.DispatchEvent(this, de);
 }
开发者ID:Gr33z00,项目名称:flashdevelop,代码行数:8,代码来源:PluginMain.cs

示例15: FindHere

 /// <summary>
 /// Opens the find and replace in files popup in the current path
 /// </summary>
 private void FindHere(Object sender, System.EventArgs e)
 {
     DataEvent de = new DataEvent(EventType.Command, "FileExplorer.FindHere", this.GetSelectedFiles());
     EventManager.DispatchEvent(this, de);
 }
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:8,代码来源:PluginUI.cs


注:本文中的PluginCore.DataEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。