public TrayIcon(Curator.Utils.IConfigManager configManager) { this._configManager = configManager; _contextMenu = new ContextMenuStrip(); this._contextMenu.Items.Add("&Configure", null, this.ConfigureContextMenuClickHandler).Font = new Font(this._contextMenu.Font, FontStyle.Bold); this._contextMenu.Items.Add("-"); this._contextMenu.Items.Add("&Next wallpaper", null, this.NextContextMenuClickHandler); this._contextMenu.Items.Add("&Previous wallpaper", null, this.PreviousContextMenuClickHandler); this._contextMenu.Items.Add("Pause slideshow", null, this.PauseContextMenuClickHandler); this._contextMenu.Items.Add("Resume slideshow", null, this.ResumeContextMenuClickHandler); this._contextMenu.Items.Add("-"); this._contextMenu.Items.Add("Force new shuffling", null, this.ShuffleContextMenuClickHandler); this._contextMenu.Items.Add("-"); this._contextMenu.Items.Add("&About", null, this.AboutContextMenuClickHandler); this._contextMenu.Items.Add("-"); this._contextMenu.Items.Add("E&xit", null, this.ExitContextMenuClickHandler); this._contextMenu.Items[5].Enabled = false; // Application starts with slideshow timer enabled _notifyIcon = new NotifyIcon() { Text = "Desktop Curator Alpha", Icon = Properties.Resources.TrayIcon, ContextMenuStrip = _contextMenu, Visible = true, }; this._notifyIcon.MouseClick += this.TrayIconClickHandler; this._notifyIcon.MouseDoubleClick += this.TrayIconDoubleClickHandler; }
public ConfigureForm(Curator.Utils.IConfigManager configManager) { InitializeComponent(); this._configManager = configManager; }
/// <summary> /// Checks that the requested build stable data is valid. /// </summary> /// <param name="player"></param> /// <param name="stables"></param> /// <param name="actionId"></param> /// <returns></returns> public static bool CanBuildStables(AgricolaPlayer player, ImmutableArray <int> stables, int actionId) { var costs = Curator.GetStablesCosts(player, actionId, stables.Length); return(player.CanAfford(costs) && player.Farmyard.IsValidStablesLocations(stables)); }
public void Edit(Curator model) { Database.Curator.Update(model); Database.Save(); }
public void Delete(Curator model) { Database.Curator.Delete(model.ID); Database.Save(); }
public void Create(Curator model) { Database.Curator.Create(model); Database.Save(); }
private static void RunTraktor(string[] args) { var logLevelSwitch = new Serilog.Core.LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information); Log.Logger = new LoggerConfiguration().MinimumLevel.ControlledBy(logLevelSwitch).WriteTo.Console(outputTemplate: "{Message}{NewLine}").WriteTo.File("Logs/.log", outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception}", rollingInterval: RollingInterval.Day).CreateLogger(); try { var config = new ConfigurationBuilder() .SetBasePath(Environment.CurrentDirectory) .AddCommandLine(args) .AddJsonFile("appsettings.json", true, true) .Build(); Interval = config.GetValue <TimeSpan?>("interval") ?? TimeSpan.FromMinutes(5); KeepAlive = config.GetValue <bool>("keepalive"); ConnectivityScriptPath = config.GetValue <string>("connectscript"); var logLevel = config.GetValue <string>("loglevel"); if (!string.IsNullOrEmpty(logLevel)) { logLevelSwitch.MinimumLevel = Enum.Parse <Serilog.Events.LogEventLevel>(logLevel); } else if (System.Diagnostics.Debugger.IsAttached) { logLevelSwitch.MinimumLevel = Serilog.Events.LogEventLevel.Debug; } Log.Information($"Minimum log level = {logLevelSwitch.MinimumLevel}"); AppDomain.CurrentDomain.UnhandledException += (sender, e) => { LogException((Exception)e.ExceptionObject); }; AppDomain.CurrentDomain.ProcessExit += (sender, e) => { Log.Information("Shutting down .."); }; if (logLevelSwitch.MinimumLevel == Serilog.Events.LogEventLevel.Verbose) { Log.Information("Logging all exceptions raised (First Chance), this also includes handled exceptions."); AppDomain.CurrentDomain.FirstChanceException += (sender, e) => { Log.Verbose($"Exception (FC): {e.Exception}"); }; } DisplayBindingIp(); //Console.ReadLine(); //return; Curator.CuratorConfiguration traktorConfig = LoadCuratorConfiguration(config, args); TraktService ts = new TraktService(); Curator curator = new Curator(ts); if (StartCurator(curator, ts, traktorConfig)) { if (!string.IsNullOrEmpty(config.GetValue <string>("urls"))) { var startup = new Traktor.Web.Startup(config, curator); var host = Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(x => { x.ConfigureServices(startup.ConfigureServices).Configure(startup.Configure); }).UseConsoleLifetime().Build().RunAsync(); Log.Information($"Running Traktor.Web @ {string.Join(", ", startup.Addresses)}"); } appSettingsHash = FileService.ComputeHash("appsettings.json"); ChangeToken.OnChange(() => config.GetReloadToken(), () => { var currentHash = FileService.ComputeHash("appsettings.json"); if (currentHash.SequenceEqual(appSettingsHash)) { return; } appSettingsHash = FileService.ComputeHash("appsettings.json"); curator.UpdateConfiguration(LoadCuratorConfiguration(config, args)); Log.Information("Updated configuration! (Changes to Downloader settings requires a restart to take effect)"); }); ScheduleCuratorUpdates(curator, ts); } } catch (Exception ex) { LogException(ex); throw; } }