本文整理汇总了C#中Preset.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Preset.Add方法的具体用法?C# Preset.Add怎么用?C# Preset.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preset
的用法示例。
在下文中一共展示了Preset.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddModToPreset
public void AddModToPreset(Mod mod, Preset preset)
{
if (!ModIsInAPreset(mod))
{
preset.Add(mod);
if (mod.IsEnabled != preset.IsEnabled)
{
modManager.ToggleEnabled(mod);
}
SavePreset(preset);
LoadModsBuffer();
}
}
示例2: AddToNewPreset
private void AddToNewPreset()
{
if (Mod.IsInOriginalInstallation())
{
MessageBox.Show("This mod cannot be added to a preset, as it is part of the core of Cortex Command.", "Notice", MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}
var addPresetWindow = new AddPresetWindow();
addPresetWindow.Owner = Global.MainWindow;
addPresetWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
var result = (bool)addPresetWindow.ShowDialog();
if (result)
{
var presetName = addPresetWindow.PresetName;
var preset = new Preset(presetName, Mod.IsEnabled);
preset.Add(Mod);
presetManager.SavePreset(preset);
if (OnAddedToPreset != null)
OnAddedToPreset(preset);
}
}
示例3: GetPresetFromFile
private Preset GetPresetFromFile(string file)
{
Preset preset;
using (StreamReader reader = new StreamReader(file))
{
string name = reader.ReadLine();
string enabledString = reader.ReadLine();
bool enabled = Boolean.Parse(enabledString);
preset = new Preset(name, enabled);
string line = reader.ReadLine();
while (line != null)
{
try
{
preset.Add(GetModDetailsFromName(line));
}
catch (FileNotFoundException) { }
line = reader.ReadLine();
}
}
return preset;
}
示例4: CreatePresetAndAddModTo
private void CreatePresetAndAddModTo(Mod mod)
{
if (mod.IsInOriginalInstallation())
{
MessageBox.Show("This mod cannot be added to a preset, as it is part of the core of Cortex Command.", "Notice", MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}
AddPresetWindow window = new AddPresetWindow();
if ((bool)window.ShowDialog())
{
string presetName = window.PresetName;
Preset preset = new Preset(presetName, mod.IsEnabled);
preset.Add(mod);
//PresetManager.SavePreset(preset);
}
HardRefreshModsList();
}