public MainViewModel() { if (IsInDesignMode) { ServerList = new ObservableCollection <Server>(new List <Server>() { new Server("Xedoc playground", false, true) }); return; } Config = Properties.Settings.Default.Config; dserverManager = (Application.Current as App).DServerManager; dserverManager.Servers.CollectionChanged += DServers_CollectionChanged; dserverManager.With(x => x.Servers).Do(x => { ServerList = x; UpdateServerList(); }); scriptManager = (Application.Current as App).ScriptManager; actionManager = (Application.Current as App).ActionManager; CurrentScriptSettings = Config.ScriptConfigs.FirstOrDefault(); var messages = (Application.Current as App).AppLogDataService.LogMessages; LogMessages = String.Join(Environment.NewLine, messages); messages.CollectionChanged += messages_CollectionChanged; }
public MainViewModel() { if (this.IsInDesignMode) { this.ServerList = new ObservableCollection <Server>(new List <Server>() { new Server("Xedoc playground", false, true) }); return; } this.Config = Settings.Default.Config; this.Config.PropertyChanged += this.Config_OnChanged; if (Application.Current is App app) { this.dserverManager = app.DServerManager; this.dserverManager.Servers.CollectionChanged += this.DServers_CollectionChanged; this.dserverManager.With(x => x.Servers).Do(x => { this.ServerList = x; this.UpdateServerList(); }); this.scriptManager = app.ScriptManager; this.actionManager = app.ActionManager; this.CurrentScriptSettings = this.Config.ScriptConfigs.FirstOrDefault(); var messages = app.AppLogDataService.LogMessages; this.LogMessages = string.Join(Environment.NewLine, messages); messages.CollectionChanged += this.messages_CollectionChanged; } }
protected override void OnStartup(StartupEventArgs e) { AppLogDataService = new AppLogDataService(); Log.WriteInfo("Application is starting..."); SettingsManager = new SettingsManager(); Regex.CacheSize = 0; WebRequest.DefaultWebProxy = null; var rootDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\IL2CDR"; AppDomain.CurrentDomain.SetData("DataDirectory", rootDataFolder); CreateDataFolders(rootDataFolder); CopyDataFolders(rootDataFolder); NativeMethods.SetProcessDPIAware(); Net.DemandTCPPermission(); if (RenderCapability.Tier == 0) { Timeline.DesiredFrameRateProperty.OverrideMetadata( typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 }); } ScriptManager = new ScriptManager(); ScriptManager.LoadScripts(); ActionManager = new ActionManager(ScriptManager); DServerManager = new DServerManager(); ScriptManager.Start(); DServerManager.Start(); }