本文整理汇总了C#中Settings类的典型用法代码示例。如果您正苦于以下问题:C# Settings类的具体用法?C# Settings怎么用?C# Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Settings类属于命名空间,在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcCells2
public static H3.Cell[] CalcCells2( Sphere[] mirrors, H3.Cell[] cells, Settings settings )
{
HashSet<Vector3D> completedCellIds = new HashSet<Vector3D>( cells.Select( c => c.ID ).ToArray() );
List<H3.Cell> completedCells = new List<H3.Cell>( cells );
ReflectCellsRecursive2( mirrors, cells, settings, completedCells, completedCellIds );
return completedCells.ToArray();
}
示例2: TestEmail
string TestEmail(Settings settings)
{
string email = settings.Email;
string smtpServer = settings.SmtpServer;
string smtpServerPort = settings.SmtpServerPort.ToString();
string smtpUserName = settings.SmtpUserName;
string smtpPassword = settings.SmtpPassword;
string enableSsl = settings.EnableSsl.ToString();
var mail = new MailMessage
{
From = new MailAddress(email, smtpUserName),
Subject = string.Format("Test mail from {0}", smtpUserName),
IsBodyHtml = true
};
mail.To.Add(mail.From);
var body = new StringBuilder();
body.Append("<div style=\"font: 11px verdana, arial\">");
body.Append("Success");
if (HttpContext.Current != null)
{
body.Append(
"<br /><br />_______________________________________________________________________________<br /><br />");
body.AppendFormat("<strong>IP address:</strong> {0}<br />", Utils.GetClientIP());
body.AppendFormat("<strong>User-agent:</strong> {0}", HttpContext.Current.Request.UserAgent);
}
body.Append("</div>");
mail.Body = body.ToString();
return Utils.SendMailMessage(mail, smtpServer, smtpServerPort, smtpUserName, smtpPassword, enableSsl.ToString());
}
示例3: Editor
private bool vueMode = false; // false = ortho, true = orbite
#endregion Fields
#region Constructors
internal Editor(EditorController _controller)
{
InitializeComponent();
controller = _controller;
// Ne pas enlever Forms : c'est pour éviter l'ambiguïté.
KeyDown += controller.KeyPressed;
KeyUp += controller.KeyUnPressed;
GamePanel.MouseDown += new Forms.MouseEventHandler(controller.MouseButtonDown);
GamePanel.MouseUp += new Forms.MouseEventHandler(controller.MouseButtonUp);
GamePanel.MouseEnter += new EventHandler(GamePanel_MouseEnter);
GamePanel.MouseLeave -= new EventHandler(GamePanel_MouseExit);
GamePanel.MouseWheel += new Forms.MouseEventHandler(controller.RouletteSouris);
GamePanel.MouseMove += new Forms.MouseEventHandler(controller.MouseMove);
/// Resize on resize only
Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(ResizeGamePanel);
settings = (new ConfigPanelData()).LoadSettings();
profiles = (new ConfigPanelData()).LoadProfiles();
var defaultProfile = profiles.Where(x => settings != null && x.CompareTo(settings.DefaultProfile) == 0);
if (defaultProfile.Count() > 0)
{
selectedProfile = defaultProfile.First();
controller.ChangeProfile(selectedProfile);
}
else
{
selectedProfile = profiles[0];
controller.ChangeProfile(selectedProfile);
}
}
示例4: Start
public void Start()
{
Settings settings = null;
var infobase = _manager.Infobases.FirstOrDefault(val => val.IsAutorun);
if (infobase == null)
{
Activity.FlipScreen(Resource.Layout.Infobases);
using (var tv = Activity.FindViewById<TextView>(Resource.Id.infobasesCaption))
using (var btn = Activity.FindViewById<Button>(Resource.Id.buttonCustomerCode))
{
tv.Text = D.INFOBASES;
btn.Text = D.ENTER_CUSTOMER_CODE;
btn.Click += OpenCustomerCodeMenu;
}
LoadList();
}
else
{
settings = new Settings(_prefs, Activity.Resources.Configuration.Locale.Language, infobase);
}
if (settings != null)
_resultCallback(settings);
}
示例5: SettingsForm
bool tray; // булевая переменная для закрития из трея
#endregion Fields
#region Constructors
public SettingsForm()
{
InitializeComponent();
tray = true;
Lock = new locker();
s = new Settings();
}
示例6: Delete
internal static void Delete(IEnumerable<Container> storages, Settings settings)
{
foreach (var storage in storages)
{
settings.Endpoint.Delete(storage.Identity);
}
}
示例7: ConnectionsViewModel
public ConnectionsViewModel(Settings settings)
: base()
{
_settings = settings;
foreach (Connection connection in _settings.GetConnections())
{
ConnectionViewModel model = new ConnectionViewModel(connection);
this.Add(model);
model.PropertyChanged += _itemChanged;
}
this.CollectionChanged += (s, e) =>
{
ConnectionViewModel connection;
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
connection = (ConnectionViewModel)e.NewItems[0];
connection.PropertyChanged += _itemChanged;
_settings.AddConnection(connection.Connection);
break;
case NotifyCollectionChangedAction.Remove:
connection = (ConnectionViewModel)e.OldItems[0];
connection.PropertyChanged -= _itemChanged;
_settings.RemoveConnection(connection.Connection);
break;
}
};
}
示例8: ShouldTakePasswordFromServerUri
public void ShouldTakePasswordFromServerUri()
{
var settings = new Settings(new Uri("http://user1:[email protected]:4242"), "testdb");
Assert.Equal("user1", settings.Credentials.UserName);
Assert.Equal("passw0rd", settings.Credentials.Password);
Assert.Equal("http://example.com:4242/", settings.ServerUri.ToString());
}
示例9: UpgradeOrInstall
const int WM_USER = 0x0400; //http://msdn.microsoft.com/en-us/library/windows/desktop/ms644931(v=vs.85).aspx
public async Task UpgradeOrInstall(IAbsoluteDirectoryPath destination, Settings settings,
params IAbsoluteFilePath[] files) {
var theShell = GetTheShell(destination, files);
if (theShell.Exists)
await Uninstall(destination, settings, files).ConfigureAwait(false);
await Install(destination, settings, files).ConfigureAwait(false);
}
示例10: TryBuild
public bool TryBuild()
{
// Ensure at least one argument for the path
if (Args.Count == 0 ||
Args.First().TrimStart().StartsWith("-"))
{
return false;
}
var settings = Args.Joined(" ")
.Split(
new[] { " -" },
StringSplitOptions.RemoveEmptyEntries);
RulePath = settings.First().Trim();
Settings = new Settings();
var restSettings = settings.Skip(1);
foreach (var item in restSettings)
{
var separatorIndex = item.IndexOf(" ");
var key = item.Substring(0, separatorIndex).Trim();
var value = item.Substring(separatorIndex + 1).Trim();
Settings[key] = value;
}
return true;
}
示例11: RubyCodeGenerator
/// <summary>
/// Initializes a new instance of the class RubyCodeGenerator.
/// </summary>
/// <param name="settings">The settings.</param>
public RubyCodeGenerator(Settings settings) : base(settings)
{
CodeNamer = new RubyCodeNamer();
this.packageVersion = Settings.PackageVersion;
this.packageName = Settings.PackageName;
if (Settings.CustomSettings.ContainsKey("Name"))
{
this.sdkName = Settings.CustomSettings["Name"].ToString();
}
if (sdkName == null)
{
this.sdkName = Path.GetFileNameWithoutExtension(Settings.Input);
}
if (sdkName == null)
{
sdkName = "client";
}
this.sdkName = RubyCodeNamer.UnderscoreCase(CodeNamer.RubyRemoveInvalidCharacters(this.sdkName));
this.sdkPath = this.packageName ?? this.sdkName;
this.modelsPath = Path.Combine(this.sdkPath, "models");
// AutoRest generated code for Ruby and Azure.Ruby generator will live inside "generated" sub-folder
settings.OutputDirectory = Path.Combine(settings.OutputDirectory, GeneratedFolderName);
}
示例12: AsyncEffectRenderer
internal AsyncEffectRenderer (Settings settings)
{
if (settings.ThreadCount < 1)
settings.ThreadCount = 1;
if (settings.TileWidth < 1)
throw new ArgumentException ("EffectRenderSettings.TileWidth");
if (settings.TileHeight < 1)
throw new ArgumentException ("EffectRenderSettings.TileHeight");
if (settings.UpdateMillis <= 0)
settings.UpdateMillis = 100;
effect = null;
source_surface = null;
dest_surface = null;
this.settings = settings;
is_rendering = false;
render_id = 0;
updated_lock = new object ();
is_updated = false;
render_exceptions = new List<Exception> ();
timer_tick_id = 0;
}
示例13: EnemyRotationHandler
public EnemyRotationHandler(
EnemyModel model,
Settings settings)
{
_settings = settings;
_model = model;
}
示例14: MainForm
public MainForm()
{
library = Library.Load();
if (library == null)
{
library = new Library();
library.Save();
}
library.Changed += library_LibraryChanged;
settings = Settings.Load(SettingsPath) ?? new Settings();
musicPlayer.OpenCompleted += equalizerSettings_ShouldSet;
musicPlayer.OpenCompleted += musicPlayer_ShouldPlay;
musicPlayer.DeviceVolume = settings.DeviceVolume;
equalizerSettings = EqualizerSettings.Load(EqualizerPath);
if (equalizerSettings == null)
{
equalizerSettings = new EqualizerSettings();
equalizerSettings.Save(EqualizerPath);
}
equalizerSettings.ValueChanged += equalizerSettings_ShouldSet;
SetUpGlobalHotkeys();
lfmHandler = new LastfmHandler();
if (settings.ScrobblingEnabled)
lfmHandler.ResumeSessionAsync();
InitializeComponent();
SetControlReferences();
}
示例15: GiveawaysWindow
public GiveawaysWindow(IExtension sender)
{
InitializeComponent();
ini = new Settings(sender, "Settings.ini", "[Default]");
UI.CenterSpacer(GiveawayTypeLabel, GiveawayTypeSpacer);
UI.CenterSpacer(GiveawaySettingsLabel, GiveawaySettingsSpacer, false, true);
UI.CenterSpacer(GiveawayBansLabel, GiveawayBansSpacer);
UI.CenterSpacer(GiveawayUsersLabel, GiveawayUsersSpacer);
Panel panel = new Panel();
panel.Size = new Size(1, 1);
panel.Location = new Point(GiveawayTypeSpacer.Location.X + GiveawayTypeSpacer.Size.Width - 1, GiveawayTypeSpacer.Location.Y + 9);
Controls.Add(panel);
panel.BringToFront();
panel = new Panel();
panel.Size = new Size(1, 1);
panel.Location = new Point(GiveawayBansSpacer.Location.X + GiveawayBansSpacer.Size.Width - 1, GiveawayBansSpacer.Location.Y + 9);
Controls.Add(panel);
panel.BringToFront();
/*panel.BackColor = Color.Black;
panel.Size = new Size(Giveaway_AddPresent.Size.Width + Giveaway_RemovePresent.Size.Width, 1);
panel.Location = new Point(Giveaway_AddPresent.Location.X, Giveaway_AddPresent.Location.Y + 1);
Controls.Add(panel);
panel.BringToFront();*/
}