本文整理汇总了C#中CommandParameters类的典型用法代码示例。如果您正苦于以下问题:C# CommandParameters类的具体用法?C# CommandParameters怎么用?C# CommandParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandParameters类属于命名空间,在下文中一共展示了CommandParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public override string Execute(string sourceText, CommandParameters parameters)
{
if (string.IsNullOrEmpty(parameters.FirstBorder) || string.IsNullOrEmpty(parameters.SecondBorder))
{
throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
}
int LastFromIndex = 0;
int LastToIndex = 0;
int NextIndex = 0;
string From = parameters.FirstBorder;
string To = parameters.SecondBorder;
int FromLength = From.Length;
int ToLength = To.Length;
bool IsChanged = false;
do
{
// FROM
Match matchFrom = FindNextMatch(From, sourceText, NextIndex, parameters);
if (matchFrom.Success)
LastFromIndex = matchFrom.Index;
else
break;
// TO
Match matchTo = FindNextMatch(To, sourceText, LastFromIndex + FromLength, parameters);
if (matchTo.Success)
LastToIndex = matchTo.Index;
else
break;
// Is need to include parameters to replace
if (parameters.IncludeParameters == true)
{
sourceText = ReplaceSubstring(sourceText, parameters.TextToAppend, LastFromIndex, LastToIndex + ToLength);
NextIndex = LastFromIndex + parameters.TextToAppend.Length;
}
else
{
sourceText = ReplaceSubstring(sourceText, parameters.TextToAppend, LastFromIndex + FromLength, LastToIndex);
NextIndex = LastFromIndex + parameters.TextToAppend.Length + FromLength + ToLength;
}
IsChanged = true;
_loopsCounter++;
if (_loopsCounter > 1000000 && !IsChanged)
{
throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
}
} while (true);
if (IsChanged == false)
throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
return sourceText;
}
开发者ID:optiklab,项目名称:MultipleTextEditor,代码行数:60,代码来源:ReplaceBetweenCommand.cs
示例2: SaveButton_Click
protected void SaveButton_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(ClassName))
{
MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName);
HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc);
historyInfo.SelectedFields.Add(FieldList.SelectedValue);
HistoryManager.SetInfo(mc, historyInfo);
ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
if (mas.Length == 0)
{
CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList");
}
if (!mas[0].FieldSet.Contains(FieldList.SelectedValue))
{
mas[0].FieldSet.Add(FieldList.SelectedValue);
mas[0].ColumnsUI.Add(new ColumnProperties(FieldList.SelectedValue, "150px", String.Empty));
ListViewProfile.SaveSystemProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList", Mediachase.IBN.Business.Security.CurrentUser.UserID, mas[0]);
}
CommandParameters cp = new CommandParameters(CommandName);
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
//CHelper.UpdateModalPopupContainer(this, ContainerId);
//CHelper.RequireDataBind();
}
}
开发者ID:0anion0,项目名称:IBN,代码行数:29,代码来源:HistoryFieldAdd.ascx.cs
示例3: SaveButton_ServerClick
protected void SaveButton_ServerClick(object sender, EventArgs e)
{
AssignmentEntity assignment = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, AssignmentId);
if (assignment != null)
{
assignment.Subject = SubjectText.Text;
if (DueDatePicker.SelectedDate != DateTime.MinValue)
assignment.PlanFinishDate = DueDatePicker.SelectedDate;
else
assignment.PlanFinishDate = null;
BusinessManager.Update(assignment);
}
// Close popup
if (!String.IsNullOrEmpty(Request["closeFramePopup"]))
{
CommandParameters cp = new CommandParameters();
if (Request["ReturnCommand"] != null)
cp.CommandName = Request["ReturnCommand"];
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, string.Empty, true);
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
"<script language='javascript'>" +
"try {window.opener.location.href=window.opener.location.href;}" +
"catch (e){} window.close();</script>");
}
}
开发者ID:0anion0,项目名称:IBN,代码行数:29,代码来源:AssignmentEdit.ascx.cs
示例4: Execute
public void Execute(MessageSender source, IrcMessage message, CommandParameters parameters)
{
if (parameters.Count == 0 || parameters.Count > 1)
throw new ParameterException();
bot.PartChannel(parameters[0]);
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:7,代码来源:PartChannel.cs
示例5: Invoke
public void Invoke(object sender, object element)
{
if (element is CommandParameters)
{
CommandParameters cp = (CommandParameters)element;
//if (!cp.CommandArguments.ContainsKey("ControlId"))
// throw new ArgumentNullException("CommandParameters.ControlId @ GoogleGadgetRefresh");
//string _cid = cp.CommandArguments["ControlId"];
if (HttpContext.Current.Session["ControlId"] == null)
throw new ArgumentNullException("Session.ControlId @ GoogleGadgetRefresh");
string _cid = HttpContext.Current.Session["ControlId"].ToString();
string id = MetaViewGroupUtil.GetIdFromUniqueKey(cp.CommandArguments["primaryKeyId"]);
HttpRequest request = HttpContext.Current.Request;
if (request != null)
{
GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(id));
ControlProperties.Provider.SaveValue(_cid, "PageSource", id);
if (gge != null)
ControlProperties.Provider.SaveValue(_cid, ControlProperties._titleKey, CHelper.GetResFileString(gge.Title));
CommandParameters cp2 = new CommandParameters("MC_GG_SelectItem");
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(((CommandManager)sender).Page, cp2.ToString());
//((CommandManager)sender).Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "", true);
}
}
}
开发者ID:0anion0,项目名称:IBN,代码行数:31,代码来源:GoogleGadgetRefresh.cs
示例6: Execute
public override string Execute(string sourceText, CommandParameters parameters)
{
if (string.IsNullOrEmpty(parameters.TextToAppend))
throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
// Escape from special symbols.
string TextToRemove = Regex.Escape(parameters.TextToAppend);
Regex regText;
// Case check
if (parameters.IsCaseSensitive == false)
regText = new Regex(TextToRemove, RegexOptions.Multiline | RegexOptions.IgnoreCase);
else
regText = new Regex(TextToRemove, RegexOptions.Multiline);
// Generate Match collection: find all occurrences of TextToRemove in sourceText.
MatchCollection mc = regText.Matches(sourceText);
if (mc.Count <= 0)
throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
int SearchTemplateLength = TextToRemove.Length;
// Remove text in all occurrences.
int Index = 0;
int IndexAdd = 0; //every time we remove text, indexes changes
foreach (Match match in mc)
{
Index = match.Index + IndexAdd;
sourceText = sourceText.Remove(Index, SearchTemplateLength);
IndexAdd -= SearchTemplateLength;
}
return sourceText;
}
开发者ID:optiklab,项目名称:MultipleTextEditor,代码行数:32,代码来源:RemoveThatCommand.cs
示例7: Execute
public override string Execute(string sourceText, CommandParameters parameters)
{
//create regular expression object from Text
string resultText = string.Empty;
if (parameters.TextToAppend != string.Empty && parameters.FirstBorder != string.Empty)
{
//escape from special symbols
string TextToReplace = Regex.Escape(parameters.FirstBorder);
Regex regText;
// Case check
if (parameters.IsCaseSensitive == false)
regText = new Regex(TextToReplace, RegexOptions.Multiline | RegexOptions.IgnoreCase);
else
regText = new Regex(TextToReplace, RegexOptions.Multiline);
resultText = regText.Replace(sourceText, parameters.TextToAppend);
if(sourceText.CompareTo(resultText) == 0)
throw new SimpleEditException((string)App.Current.FindResource("TextNotFoundError"));
}
else
throw new SimpleEditException((string)App.Current.FindResource("ErrorCommandParametersEmpty"));
return resultText;
}
开发者ID:optiklab,项目名称:MultipleTextEditor,代码行数:27,代码来源:ReplaceThatCommand.cs
示例8: btnCancel_Click
void btnCancel_Click(object sender, EventArgs e)
{
CommandParameters cp = new CommandParameters(Request["CommandName"]);
cp.CommandArguments = new Dictionary<string, string>();
cp.AddCommandArgument("Uid", "null");
CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
}
开发者ID:0anion0,项目名称:IBN,代码行数:7,代码来源:UpdateConfirmation.ascx.cs
示例9: OkButton_Click
protected void OkButton_Click(object sender, EventArgs e)
{
string refreshCommand = Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetRefreshCommand(this.Page);
string paramString = String.Empty;
if (!String.IsNullOrEmpty(refreshCommand))
{
CommandParameters cp = new CommandParameters(refreshCommand);
cp.CommandArguments = new Dictionary<string, string>();
cp.AddCommandArgument("DeleteType", DeleteTypeList.SelectedValue);
if (ObjectId != PrimaryKeyId.Empty)
{
cp.AddCommandArgument("ObjectId", ObjectId.ToString());
paramString = cp.ToString();
}
else if (Request.QueryString["GridId"] != null)
{
cp.AddCommandArgument("GridId", Request.QueryString["GridId"]);
paramString = cp.ToString();
}
else
{
paramString = String.Empty;
}
}
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, paramString);
}
开发者ID:0anion0,项目名称:IBN,代码行数:28,代码来源:OrgItemsDeleteConfirm.ascx.cs
示例10: AddButton_Click
protected void AddButton_Click(object sender, EventArgs e)
{
if (Process())
{
CommandParameters cp = new CommandParameters("MC_TimeTracking_QuickAddManagerFrame");
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterRefreshParentFromFrameScript(this.Page, cp.ToString());
}
}
开发者ID:0anion0,项目名称:IBN,代码行数:8,代码来源:QuickAddManager.ascx.cs
示例11: btnExport_Click
protected void btnExport_Click(object sender, EventArgs e)
{
CommandParameters cp = new CommandParameters(_refreshCommand);
cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
cp.AddCommandArgument("Type", _type);
cp.AddCommandArgument("Variant", rbList.SelectedValue);
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
}
开发者ID:0anion0,项目名称:IBN,代码行数:8,代码来源:IncidentListExport.ascx.cs
示例12: btnOnlyThis_Click
void btnOnlyThis_Click(object sender, EventArgs e)
{
PrimaryKeyId pKey = PrimaryKeyId.Parse(Request["ObjectId"]);
CommandParameters cp = new CommandParameters(Request["CommandName"]);
cp.CommandArguments = new Dictionary<string, string>();
cp.AddCommandArgument("Uid", pKey.ToString());
CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
}
开发者ID:0anion0,项目名称:IBN,代码行数:8,代码来源:UpdateConfirmation.ascx.cs
示例13: GetPassword
private string GetPassword(CommandParameters parameters)
{
var password = "";
if (parameters.Count > 1)
password = parameters[1];
return password;
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:8,代码来源:JoinChannel.cs
示例14: Execute
public void Execute(MessageSender executor, IrcMessage message, CommandParameters parameters)
{
if (parameters.Count == 0)
return;
var sendToServerMessage = GetParametersInOneSentence(parameters);
bot.SendToServer(sendToServerMessage);
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:9,代码来源:SendToServer.cs
示例15: btnSave_ServerClick
void btnSave_ServerClick(object sender, EventArgs e)
{
Mediachase.IBN.Business.PortalConfig.MdsDeliveryTimeout = int.Parse(txtDeliveryTimeout.Text) * 24 * 60;
Mediachase.IBN.Business.PortalConfig.MdsMaxDeliveryAttempts = int.Parse(txtAttempts.Text);
Mediachase.IBN.Business.PortalConfig.MdsDeleteOlderMoreThan = int.Parse(txtLogPeriod.Text) * 24 * 60;
CommandParameters cp = new CommandParameters("MC_MUI_ChangeSettings");
CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
}
开发者ID:0anion0,项目名称:IBN,代码行数:9,代码来源:OutgoingEmailLogSettings.ascx.cs
示例16: Add_Click
protected void Add_Click(object sender, System.EventArgs e)
{
int RelProjectId = int.Parse(hdnProjectId.Value);
if (ProjectId > 0 && ProjectId != RelProjectId)
Project2.AddRelation(ProjectId, RelProjectId);
CommandParameters cp = new CommandParameters("MC_PM_Redirect");
Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
}
开发者ID:0anion0,项目名称:IBN,代码行数:9,代码来源:AddRelFromClip.aspx.cs
示例17: Execute
public void Execute(MessageSender source, IrcMessage message, CommandParameters parameters)
{
if (parameters == null || parameters.Count == 0)
return;
var sayToMessage = GetMessageFromParameters(parameters);
bot.SayTo(source.Channel, sayToMessage);
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:9,代码来源:SayTo.cs
示例18: Execute
public void Execute(MessageSender executor, IrcMessage message, CommandParameters parameters)
{
var commands = bot.GetAllCommands();
foreach (var command in commands)
{
bot.SayTo(executor.Channel, command.GetKeyWord());
}
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:9,代码来源:ListCommands.cs
示例19: CommandMain
public static void CommandMain(CommandParameters parameters, ICommandExecutor executor)
{
var targets = from Character c in executor.Server.Characters where c.Name == parameters.Get<string>(0) select c;
if (targets.Count() == 0)
throw new Exception("Target not found");
Character target = targets.First<Character>();
String title = parameters.Get<String>(1, "");
target.Title = title;
}
开发者ID:Bart97,项目名称:BeemuSharp,代码行数:10,代码来源:St.cs
示例20: GetParametersInOneSentence
private string GetParametersInOneSentence(CommandParameters parameters)
{
var sendToServerMessage = new StringBuilder();
foreach (var parameter in parameters)
{
sendToServerMessage.Append(parameter);
sendToServerMessage.Append(" ");
}
return sendToServerMessage.ToString().TrimEnd();
}
开发者ID:mikoskinen,项目名称:ircbot-dotnet,代码行数:10,代码来源:SendToServer.cs
注:本文中的CommandParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论