本文整理汇总了C#中EcasAction类的典型用法代码示例。如果您正苦于以下问题:C# EcasAction类的具体用法?C# EcasAction怎么用?C# EcasAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EcasAction类属于命名空间,在下文中一共展示了EcasAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateDataEx
private bool UpdateDataEx(EcasAction a, bool bGuiToInternal, bool bDxTypeInfo)
{
m_bBlockTypeSelectionHandler = true;
bool bResult = EcasUtil.UpdateDialog(EcasObjectType.Action, m_cmbActions,
m_dgvParams, a, bGuiToInternal, bDxTypeInfo);
m_bBlockTypeSelectionHandler = false;
return bResult;
}
示例2: Execute
public void Execute(EcasAction a, EcasContext ctx)
{
if(a == null) throw new ArgumentNullException("a");
foreach(EcasActionType t in m_actions)
{
if(t.Type.EqualsValue(a.Type))
{
t.ExecuteMethod(a, ctx);
return;
}
}
throw new NotSupportedException();
}
示例3: ExecuteGlobalAutoType
private static void ExecuteGlobalAutoType(EcasAction a, EcasContext ctx)
{
Program.MainForm.ExecuteGlobalAutoType();
}
示例4: ExecuteSelectedAutoType
private static void ExecuteSelectedAutoType(EcasAction a, EcasContext ctx)
{
try
{
// Do not Spr-compile the sequence here; it'll be compiled by
// the auto-type engine (and this expects an auto-type sequence
// as input, not a data string; compiling it here would e.g.
// result in broken '%' characters in passwords)
string strSeq = EcasUtil.GetParamString(a.Parameters, 0, false);
if(string.IsNullOrEmpty(strSeq)) strSeq = null;
PwEntry pe = Program.MainForm.GetSelectedEntry(true);
if(pe == null) return;
PwDatabase pd = Program.MainForm.DocumentManager.SafeFindContainerOf(pe);
IntPtr hFg = NativeMethods.GetForegroundWindowHandle();
if(AutoType.IsOwnWindow(hFg))
AutoType.PerformIntoPreviousWindow(Program.MainForm, pe,
pd, strSeq);
else AutoType.PerformIntoCurrentWindow(pe, pd, strSeq);
}
catch(Exception) { Debug.Assert(false); }
}
示例5: ExportDatabaseFile
private static void ExportDatabaseFile(EcasAction a, EcasContext ctx)
{
string strPath = EcasUtil.GetParamString(a.Parameters, 0, true);
// if(string.IsNullOrEmpty(strPath)) return; // Allow no-file exports
string strFormat = EcasUtil.GetParamString(a.Parameters, 1, true);
if(string.IsNullOrEmpty(strFormat)) return;
string strGroup = EcasUtil.GetParamString(a.Parameters, 2, true);
string strTag = EcasUtil.GetParamString(a.Parameters, 3, true);
PwDatabase pd = Program.MainForm.ActiveDatabase;
if((pd == null) || !pd.IsOpen) return;
PwGroup pg = pd.RootGroup;
if(!string.IsNullOrEmpty(strGroup))
{
char chSep = strGroup[0];
PwGroup pgSub = pg.FindCreateSubTree(strGroup.Substring(1),
new char[] { chSep }, false);
pg = (pgSub ?? (new PwGroup(true, true, KPRes.Group, PwIcon.Folder)));
}
if(!string.IsNullOrEmpty(strTag))
{
// Do not use pg.Duplicate, because this method
// creates new UUIDs
pg = pg.CloneDeep();
pg.TakeOwnership(true, true, true);
GroupHandler gh = delegate(PwGroup pgSub)
{
PwObjectList<PwEntry> l = pgSub.Entries;
long n = (long)l.UCount;
for(long i = n - 1; i >= 0; --i)
{
if(!l.GetAt((uint)i).HasTag(strTag))
l.RemoveAt((uint)i);
}
return true;
};
gh(pg);
pg.TraverseTree(TraversalMethod.PreOrder, gh, null);
}
PwExportInfo pei = new PwExportInfo(pg, pd, true);
IOConnectionInfo ioc = (!string.IsNullOrEmpty(strPath) ?
IOConnectionInfo.FromPath(strPath) : null);
ExportUtil.Export(pei, strFormat, ioc);
}
示例6: CloseDatabaseFile
private static void CloseDatabaseFile(EcasAction a, EcasContext ctx)
{
Program.MainForm.CloseDocument(null, false, false, true);
}
示例7: RemoveToolBarButton
private static void RemoveToolBarButton(EcasAction a, EcasContext ctx)
{
string strID = EcasUtil.GetParamString(a.Parameters, 0, true);
Program.MainForm.RemoveCustomToolBarButton(strID);
}
示例8: ShowEntriesByTag
private static void ShowEntriesByTag(EcasAction a, EcasContext ctx)
{
string strTag = EcasUtil.GetParamString(a.Parameters, 0, true);
Program.MainForm.ShowEntriesByTag(strTag);
}
示例9: ExportDatabaseFile
private static void ExportDatabaseFile(EcasAction a, EcasContext ctx)
{
string strPath = EcasUtil.GetParamString(a.Parameters, 0, true);
// if(string.IsNullOrEmpty(strPath)) return; // Allow no-file exports
string strFormat = EcasUtil.GetParamString(a.Parameters, 1, true);
if(string.IsNullOrEmpty(strFormat)) return;
PwDatabase pd = Program.MainForm.ActiveDatabase;
if((pd == null) || !pd.IsOpen) return;
PwExportInfo pei = new PwExportInfo(pd.RootGroup, pd, true);
IOConnectionInfo ioc = (!string.IsNullOrEmpty(strPath) ?
IOConnectionInfo.FromPath(strPath) : null);
ExportUtil.Export(pei, strFormat, ioc);
}
示例10: KeyFromParams
private static CompositeKey KeyFromParams(EcasAction a, int iPassword,
int iKeyFile, int iUserAccount)
{
string strPassword = EcasUtil.GetParamString(a.Parameters, iPassword, true);
string strKeyFile = EcasUtil.GetParamString(a.Parameters, iKeyFile, true);
bool bUserAccount = StrUtil.StringToBool(EcasUtil.GetParamString(
a.Parameters, iUserAccount, true));
CompositeKey cmpKey = null;
if(!string.IsNullOrEmpty(strPassword) || !string.IsNullOrEmpty(strKeyFile) ||
bUserAccount)
{
List<string> vArgs = new List<string>();
if(!string.IsNullOrEmpty(strPassword))
vArgs.Add("-" + AppDefs.CommandLineOptions.Password + ":" + strPassword);
if(!string.IsNullOrEmpty(strKeyFile))
vArgs.Add("-" + AppDefs.CommandLineOptions.KeyFile + ":" + strKeyFile);
if(bUserAccount)
vArgs.Add("-" + AppDefs.CommandLineOptions.UserAccount);
CommandLineArgs cmdArgs = new CommandLineArgs(vArgs.ToArray());
cmpKey = KeyUtil.KeyFromCommandLine(cmdArgs);
}
return cmpKey;
}
示例11: OnActionAdd
private void OnActionAdd(object sender, EventArgs e)
{
EcasAction eNew = new EcasAction();
EcasActionForm dlg = new EcasActionForm();
dlg.InitEx(eNew);
if(UIUtil.ShowDialogAndDestroy(dlg) == DialogResult.OK)
{
m_trigger.ActionCollection.Add(eNew);
UpdateActionListEx(false);
}
}
示例12: ExecuteShellCmd
private static void ExecuteShellCmd(EcasAction a, EcasContext ctx)
{
string strCmd = EcasUtil.GetParamString(a.Parameters, 0, true, true);
string strArgs = EcasUtil.GetParamString(a.Parameters, 1, true, true);
bool bWait = StrUtil.StringToBool(EcasUtil.GetParamString(a.Parameters,
2, string.Empty));
if(string.IsNullOrEmpty(strCmd)) return;
try
{
Process p;
if(string.IsNullOrEmpty(strArgs)) p = Process.Start(strCmd);
else p = Process.Start(strCmd, strArgs);
if((p != null) && bWait)
{
Program.MainForm.UIBlockInteraction(true);
MessageService.ExternalIncrementMessageCount();
try { p.WaitForExit(); }
catch(Exception) { Debug.Assert(false); }
MessageService.ExternalDecrementMessageCount();
Program.MainForm.UIBlockInteraction(false);
}
}
catch(Exception e)
{
throw new Exception(strCmd + MessageService.NewParagraph + e.Message);
}
}
示例13: InitEx
public void InitEx(EcasAction e)
{
m_actionInOut = e;
m_action = e.CloneDeep();
}
示例14: OpenDatabaseFile
private static void OpenDatabaseFile(EcasAction a, EcasContext ctx)
{
string strPath = EcasUtil.GetParamString(a.Parameters, 0, true);
if(string.IsNullOrEmpty(strPath)) return;
string strIOUserName = EcasUtil.GetParamString(a.Parameters, 1, true);
string strIOPassword = EcasUtil.GetParamString(a.Parameters, 2, true);
IOConnectionInfo ioc = IOFromParameters(strPath, strIOUserName, strIOPassword);
if(ioc == null) return;
string strPassword = EcasUtil.GetParamString(a.Parameters, 3, true);
string strKeyFile = EcasUtil.GetParamString(a.Parameters, 4, true);
bool bUserAccount = StrUtil.StringToBool(EcasUtil.GetParamString(
a.Parameters, 5, true));
CompositeKey cmpKey = null;
if(!string.IsNullOrEmpty(strPassword) || !string.IsNullOrEmpty(strKeyFile) ||
bUserAccount)
{
List<string> vArgs = new List<string>();
if(!string.IsNullOrEmpty(strPassword))
vArgs.Add("-" + AppDefs.CommandLineOptions.Password + ":" + strPassword);
if(!string.IsNullOrEmpty(strKeyFile))
vArgs.Add("-" + AppDefs.CommandLineOptions.KeyFile + ":" + strKeyFile);
if(bUserAccount)
vArgs.Add("-" + AppDefs.CommandLineOptions.UserAccount);
CommandLineArgs cmdArgs = new CommandLineArgs(vArgs.ToArray());
cmpKey = KeyUtil.KeyFromCommandLine(cmdArgs);
}
Program.MainForm.OpenDatabase(ioc, cmpKey, ioc.IsLocalFile());
}
示例15: ExecuteShellCmd
private static void ExecuteShellCmd(EcasAction a, EcasContext ctx)
{
string strCmd = EcasUtil.GetParamString(a.Parameters, 0, true);
string strArgs = EcasUtil.GetParamString(a.Parameters, 1, true);
if(string.IsNullOrEmpty(strCmd)) return;
try
{
if(string.IsNullOrEmpty(strArgs)) Process.Start(strCmd);
else Process.Start(strCmd, strArgs);
}
catch(Exception e)
{
throw new Exception(strCmd + MessageService.NewParagraph + e.Message);
}
}