本文整理汇总了C#中Plan.TryAddSet方法的典型用法代码示例。如果您正苦于以下问题:C# Plan.TryAddSet方法的具体用法?C# Plan.TryAddSet怎么用?C# Plan.TryAddSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plan
的用法示例。
在下文中一共展示了Plan.TryAddSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: miCopyToNewPlan_Click
/// <summary>
/// Context > Copy to new plan...
/// Opens a dialog to prompt the user for a name and create a plan with the selected entries.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void miCopyToNewPlan_Click(object sender, EventArgs e)
{
IList<PlanEntry> entries = SelectedEntries.ToList();
if (!entries.Any())
return;
// Ask the user for a new name
string planName,
planDescription;
using (NewPlanWindow npw = new NewPlanWindow())
{
DialogResult dr = npw.ShowDialog();
if (dr == DialogResult.Cancel)
return;
planName = npw.PlanName;
planDescription = npw.PlanDescription;
}
// Create a new plan
Plan newPlan = new Plan(m_character) { Name = planName, Description = planDescription };
IPlanOperation operation = newPlan.TryAddSet(entries, $"Exported from {m_plan.Name}");
operation.Perform();
// Add plan and save
m_character.Plans.Add(newPlan);
}
示例2: miCopySelectedToClipboard_Click
/// <summary>
/// Context > Copy selected skills to Clipboard
/// Copy selected entries to clipoboard
/// for importation in EVE client Skill Queue
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void miCopySelectedToClipboard_Click(object sender, EventArgs e)
{
// Create a new plan
Plan newPlan = new Plan(m_character);
IPlanOperation operation = newPlan.TryAddSet(SelectedEntries, $"Exported from {m_plan.Name}");
operation.Perform();
// Prompt the user for settings. When null, the user cancelled
PlanExportSettings settings = UIHelper.PromptUserForPlanExportSettings(newPlan);
if (settings == null)
return;
string output = PlanIOHelper.ExportAsText(newPlan, settings);
// Copy the result to the clipboard
try
{
Clipboard.Clear();
Clipboard.SetText(output);
MessageBox.Show(@"The selected entries have been copied to the clipboard.",
@"Plan Copied",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (ExternalException ex)
{
ExceptionHandler.LogException(ex, true);
MessageBox.Show(@"The copy to clipboard has failed. You may retry later.",
@"Plan Copy Failure",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
示例3: miCopyToNewPlan_Click
/// <summary>
/// Context > Copy to new plan...
/// Opens a dialog to prompt the user for a name and create a plan with the selected entries.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void miCopyToNewPlan_Click(object sender, EventArgs e)
{
var entries = SelectedEntries;
if (entries.IsEmpty())
return;
// Ask the user for a new name
string planName;
using (NewPlanWindow npw = new NewPlanWindow())
{
DialogResult dr = npw.ShowDialog();
if (dr == DialogResult.Cancel)
return;
planName = npw.Result;
}
// Create a new plan
Plan newPlan = new Plan(Character);
newPlan.Name = planName;
var operation = newPlan.TryAddSet(entries, "Exported from " + m_plan.Name);
operation.Perform();
// Add plan and save
Character.Plans.Add(newPlan);
}