本文整理汇总了C#中PluginCore.NotifyEvent类的典型用法代码示例。如果您正苦于以下问题:C# NotifyEvent类的具体用法?C# NotifyEvent怎么用?C# NotifyEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotifyEvent类属于PluginCore命名空间,在下文中一共展示了NotifyEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updater_Tick
void updater_Tick(object sender, EventArgs e)
{
updater.Stop();
string src = File.Exists(logFile) ? File.ReadAllText(logFile) : "";
MatchCollection matches = reError.Matches(src);
TextEvent te;
if (matches.Count == 0)
{
te = new TextEvent(EventType.ProcessEnd, "Done(0)");
EventManager.DispatchEvent(this, te);
if (!te.Handled) PlaySWF();
return;
}
NotifyEvent ne = new NotifyEvent(EventType.ProcessStart);
EventManager.DispatchEvent(this, ne);
foreach (Match m in matches)
{
string file = m.Groups["file"].Value;
string line = m.Groups["line"].Value;
string desc = m.Groups["desc"].Value.Trim();
TraceManager.Add(String.Format("{0}:{1}: {2}", file, line, desc), -3);
}
te = new TextEvent(EventType.ProcessEnd, "Done(" + matches.Count + ")");
EventManager.DispatchEvent(this, te);
(PluginBase.MainForm as Form).Activate();
(PluginBase.MainForm as Form).Focus();
}
示例2: HandleEvent
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
if (e.Type == EventType.ApplyTheme)
{
RefreshColors();
}
}
示例3: 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);
}
}
示例4: AddMessage
/**
* Adds a new entry to the log
*/
public static void AddMessage(string message, int state)
{
log.Add(new TraceEntry(message, state));
//
NotifyEvent ne = new NotifyEvent(EventType.LogEntry);
Global.Plugins.NotifyPlugins(null, ne);
}
示例5: updater_Tick
void updater_Tick(object sender, EventArgs e)
{
updater.Stop();
string src = File.Exists(logFile) ? File.ReadAllText(logFile) : "";
MatchCollection errorMatches = reError.Matches(src);
MatchCollection warningMatches = warnError.Matches(src);
TextEvent te;
if (errorMatches.Count == 0 && warningMatches.Count == 0)
{
te = new TextEvent(EventType.ProcessEnd, "Done(0)");
EventManager.DispatchEvent(this, te);
if (!te.Handled) PlaySWF();
return;
}
NotifyEvent ne = new NotifyEvent(EventType.ProcessStart);
EventManager.DispatchEvent(this, ne);
foreach (Match m in errorMatches)
{
string file = m.Groups["file"].Value;
string line = m.Groups["line"].Value;
string desc = m.Groups["desc"].Value.Trim();
Match mCol = Regex.Match(desc, @"\s*[a-z]+\s([0-9]+)\s");
if (mCol.Success)
{
line += "," + mCol.Groups[1].Value;
desc = desc.Substring(mCol.Length);
}
TraceManager.Add(String.Format("{0}({1}): {2}", file, line, desc), -3);
}
foreach (Match m in warningMatches)
{
string file = m.Groups["file"].Value;
string line = m.Groups["line"].Value;
string desc = m.Groups["desc"].Value.Trim();
Match mCol = Regex.Match(desc, @"\s*[a-z]+\s([0-9]+)\s");
if (mCol.Success)
{
line += "," + mCol.Groups[1].Value;
desc = desc.Substring(mCol.Length);
}
TraceManager.Add(String.Format("{0}({1}): {2}", file, line, desc), -3);
}
te = new TextEvent(EventType.ProcessEnd, "Done(" + errorMatches.Count + ")");
EventManager.DispatchEvent(this, te);
if (errorMatches.Count == 0)
{
if (!te.Handled)
{
PlaySWF();
return;
}
}
(PluginBase.MainForm as Form).Activate();
(PluginBase.MainForm as Form).Focus();
}
示例6: HandleEvent
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
switch (e.Type)
{
case EventType.Trace:
ProcessTraces();
ui.EndUpdate();
break;
}
}
示例7: HandleEvent
public void HandleEvent(object sender, NotifyEvent e,
HandlingPriority priority)
{
var de = e as DataEvent;
// If it's a DE event with subs for the DE's action
if (de != null && subs.ContainsKey (de.Action)) {
subs[de.Action].ForEach (i => i (de));
}
}
示例8: HandleEvent
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
switch (e.Type)
{
case EventType.ProcessStart:
ui.BeginUpdate();
break;
case EventType.ProcessEnd:
ui.EndUpdate();
break;
}
}
示例9: HandleEvent
/// <summary>
/// Handle the incoming theme events
/// </summary>
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
{
if (e.Type == EventType.ApplyTheme)
{
Boolean enabled = PluginBase.MainForm.GetThemeColor("ScrollBar.ForeColor") != Color.Empty;
if (enabled && !this.Controls.Contains(this.vScrollBar))
{
this.AddScrollBars(this);
}
else if (!enabled && this.Controls.Contains(this.vScrollBar))
{
this.RemoveScrollBars(this);
}
}
}
示例10: HandleEvent
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
Project project;
switch (e.Type)
{
case EventType.Command:
DataEvent evt = (DataEvent)e;
if (evt.Action == "ProjectManager.CreateNewFile")
{
Hashtable table = evt.Data as Hashtable;
project = PluginBase.CurrentProject as Project;
if ((project.Language.StartsWith("as")) && IsModuleTemplate(table["templatePath"] as String))
{
evt.Handled = true;
showWizard(table["inDirectory"] as string, table["templatePath"] as String);
//String className = table.ContainsKey("className") ? table["className"] as String : TextHelper.GetString("Wizard.Label.NewClass");
//DisplayClassWizard(table["inDirectory"] as String, table["templatePath"] as String, className, table["constructorArgs"] as String, table["constructorArgTypes"] as List<String>);
}
}
break;
//case EventType.FileSwitch:
// if (PluginBase.MainForm.CurrentDocument.FileName == processOnSwitch)
// {
// processOnSwitch = null;
// if (lastFileOptions == null || lastFileOptions.interfaces == null) return;
// foreach (String cname in lastFileOptions.interfaces)
// {
// ASContext.Context.CurrentModel.Check();
// ClassModel inClass = ASContext.Context.CurrentModel.GetPublicClass();
// ASGenerator.SetJobContext(null, cname, null, null);
// ASGenerator.GenerateJob(GeneratorJobType.ImplementInterface, null, inClass, null, null);
// }
// lastFileOptions = null;
// }
// break;
case EventType.ProcessArgs:
TextEvent te = e as TextEvent;
project = PluginBase.CurrentProject as Project;
if (lastFileFromTemplate != null && project != null && (project.Language.StartsWith("as")))
{
te.Value = ProcessArgs(project, te.Value);
}
break;
}
}
示例11: HandleEvent
/**
* Handles the incoming file save events
*/
public void HandleEvent(object sender, NotifyEvent e)
{
if (e.Type == EventType.FileSaving)
{
TextEvent te = (TextEvent)e;
if (te.Text.ToLower() == this.FilePath.ToLower())
{
this.fileInfo = null;
}
}
else if (e.Type == EventType.FileSave)
{
TextEvent te = (TextEvent)e;
if (te.Text.ToLower() == this.FilePath.ToLower())
{
this.fileInfo = new FileInfo(this.FilePath);
}
}
}
示例12: HandleEvent
// Receives only eventMask events
public void HandleEvent(object sender, NotifyEvent e)
{
if (e.Type == EventType.FileOpen)
{
string path = MainForm.CurFile;
string extension = Path.GetExtension(path);
if (extension.ToLower() == ".swf")
DisplaySwf(MainForm.CurFile);
}
else if (e.Type == EventType.Command)
{
TextEvent te = e as TextEvent;
if (te.Text.StartsWith(COMMAND_POPUPSWF))
{
string[] split = te.Text.Split(';');
string path = split[2];
int width = int.Parse(split[3]);
int height = int.Parse(split[4]);
PopupSwf(path,width,height);
}
}
}
示例13: DispatchEvent
/// <summary>
/// Dispatches an event to the registered event handlers
/// </summary>
public static void DispatchEvent(Object sender, NotifyEvent e)
{
try
{
List<EventObject>[] objectList = GetObjectListCollection();
for (Int32 i = 0; i < objectList.Length; i++)
{
List<EventObject> subObjects = objectList[i];
for (Int32 j = 0; j < subObjects.Count; j++)
{
EventObject obj = subObjects[j];
if ((obj.Mask & e.Type) > 0)
{
obj.Handler.HandleEvent(sender, e, obj.Priority);
if (e.Handled) return;
}
}
}
}
catch (Exception ex)
{
ErrorManager.ShowError(ex);
}
}
示例14: HandleEvent
/// <summary>
/// Handles the incoming events
/// </summary>
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
{
switch (e.Type)
{
case EventType.ProcessStart:
this.pluginUI.ClearOutput(null, null);
break;
case EventType.ProcessEnd:
if (this.settingObject.ShowOnProcessEnd && !this.settingObject.ShowOnOutput)
{
this.pluginUI.DisplayOutput();
}
break;
case EventType.Trace:
this.pluginUI.AddTraces();
if (this.settingObject.ShowOnOutput)
{
this.pluginUI.DisplayOutput();
}
break;
case EventType.Keys:
Keys keys = (e as KeyEvent).Value;
e.Handled = this.pluginUI.OnShortcut(keys);
break;
case EventType.ApplySettings:
this.pluginUI.ApplyWrapText();
break;
}
}
示例15: HandleEvent
/**
* Handles the incoming events
*/
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
{
try
{
// ignore all events when leaving
if (PluginBase.MainForm.ClosingEntirely) return;
// current active document
ITabbedDocument doc = PluginBase.MainForm.CurrentDocument;
// application start
if (!started && e.Type == EventType.UIStarted)
{
started = true;
PathExplorer.OnUIStarted();
// associate context to initial document
e = new NotifyEvent(EventType.SyntaxChange);
this.pluginUI.UpdateAfterTheme();
}
// editor ready?
if (doc == null) return;
ScintillaControl sci = doc.IsEditable ? doc.SciControl : null;
//
// Events always handled
//
bool isValid;
DataEvent de;
switch (e.Type)
{
// caret position in editor
case EventType.UIRefresh:
if (!doc.IsEditable) return;
timerPosition.Enabled = false;
timerPosition.Enabled = true;
return;
// key combinations
case EventType.Keys:
Keys key = (e as KeyEvent).Value;
if (ModelsExplorer.HasFocus)
{
e.Handled = ModelsExplorer.Instance.OnShortcut(key);
return;
}
if (!doc.IsEditable) return;
e.Handled = ASComplete.OnShortcut(key, sci);
return;
// user-customized shortcuts
case EventType.Shortcut:
de = e as DataEvent;
if (de.Action == "Completion.ShowHelp")
{
ASComplete.HelpKeys = (Keys)de.Data;
de.Handled = true;
}
return;
//
// File management
//
case EventType.FileSave:
if (!doc.IsEditable) return;
ASContext.Context.CheckModel(false);
// toolbar
isValid = ASContext.Context.IsFileValid;
if (isValid && !PluginBase.MainForm.SavingMultiple)
{
if (ASContext.Context.Settings.CheckSyntaxOnSave) CheckSyntax(null, null);
ASContext.Context.RemoveClassCompilerCache();
}
return;
case EventType.SyntaxDetect:
// detect Actionscript language version
if (!doc.IsEditable) return;
if (doc.FileName.ToLower().EndsWithOrdinal(".as"))
{
settingObject.LastASVersion = DetectActionscriptVersion(doc);
(e as TextEvent).Value = settingObject.LastASVersion;
e.Handled = true;
}
break;
case EventType.ApplySettings:
case EventType.SyntaxChange:
case EventType.FileSwitch:
if (!doc.IsEditable)
{
ASContext.SetCurrentFile(null, true);
ContextChanged();
return;
}
currentDoc = doc.FileName;
currentPos = sci.CurrentPos;
// check file
//.........这里部分代码省略.........