public LicenseStatusBar(IWindowManagerEx windowManager, NetworkOperations network) { this.network = network; this.windowManager = windowManager; ContactUs = Command.Create(OnContactUsClicked); ManageLicense = Command.Create(OnManageLicense); }
public void Initialize() { networkOperations = Substitute.For <NetworkOperations>(); serviceControl = Substitute.For <IServiceControl>(); licenseRegistration = Substitute.For <LicenseRegistrationViewModel>(); sut = new AboutViewModel(networkOperations, serviceControl, licenseRegistration); }
public LicenseRegistrationViewModel( AppLicenseManager licenseManager, IWindowManagerEx dialogManager, NetworkOperations network) { this.licenseManager = licenseManager; this.dialogManager = dialogManager; this.network = network; }
// Use this for initialization void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
public LicenseMessageBoxViewModel( AppLicenseManager licenseManager, NetworkOperations networkOperations, IWindowManagerEx windowManager, IAppCommands appCommands) { this.licenseManager = licenseManager; this.networkOperations = networkOperations; this.windowManager = windowManager; this.appCommands = appCommands; SetupLicenseOptions(); }
public AboutViewModel( NetworkOperations networkOperations, IServiceControl serviceControl, LicenseRegistrationViewModel licenseInfo) { this.serviceControl = serviceControl; License = licenseInfo; IsSplash = false; DisplayName = "About"; NavigateToSiteCommand = this.CreateCommand(() => networkOperations.Browse("http://www.particular.net")); }
public ManageLicenseViewModel( AppLicenseManager licenseManager, NetworkOperations network, IWindowManagerEx windowManager, IEventAggregator eventAggregator) { this.licenseManager = licenseManager; this.network = network; this.windowManager = windowManager; this.eventAggregator = eventAggregator; DisplayName = "License Information"; ContactUsCommand = Command.Create(ContactUs); }
private void UpdateGeneration() { foreach (var session in _sessions) { if (session.GameState == GameState.Running) { session.NextTurn(); } } if (_sessions.Count > 0) { _maxScore = Math.Max(_maxScore, _sessions[0].Board.Score); } if (_sessions.Count > 0 && (_sessions.TrueForAll(p => p.GameState == GameState.Done || p.Board.Turn >= 60))) { var sortedBoards = _sessions.OrderByDescending(p => p.Board.Score).ToList(); var bestBoards = sortedBoards.Take(3).ToList(); _avgScore = (int)_sessions.Average(p => p.Board.Score); _sessions.Clear(); var networkOperations = new NetworkOperations(); var seed = (int)DateTime.Now.Ticks; foreach (var board in bestBoards) { var main = new GameSession(BoardWidth, BoardHeight, FoodInterval, FoodDensity, Neurons, Alpha, seed, board.NeuralNetwork); _sessions.Add(main); for (var i = 0; i < 5; i++) { var leftParent = bestBoards[_random.Next(bestBoards.Count)].NeuralNetwork; var rightParent = bestBoards[_random.Next(bestBoards.Count)].NeuralNetwork; var clonedNetwork = networkOperations.Breed(leftParent, rightParent); var gameSession = new GameSession(BoardWidth, BoardHeight, FoodInterval, FoodDensity, Neurons, Alpha, seed, clonedNetwork); networkOperations.Mutate(clonedNetwork); _sessions.Add(gameSession); } } _generation++; } }
public EndpointExplorerViewModel( IEventAggregator eventAggregator, ISettingsProvider settingsProvider, ServiceControlConnectionProvider connectionProvider, CommandLineArgParser commandLineParser, IServiceControl serviceControl, NetworkOperations networkOperations) { this.eventAggregator = eventAggregator; this.settingsProvider = settingsProvider; this.serviceControl = serviceControl; this.networkOperations = networkOperations; this.connectionProvider = connectionProvider; this.commandLineParser = commandLineParser; Items = new BindableCollection <ExplorerItem>(); }
// Use this for initialization void Start() { networkOperations = new NetworkOperations(); Display = new NetworkClient(); Control = new NetworkClient(); networkOperations.Connect(Display, NetworkOperations.DisplayIP, NetworkOperations.ConnectionPort); // Connect(Screen, ScreenIP, ConnectionPort); networkOperations.Connect(Control, NetworkOperations.ControlIP, NetworkOperations.ConnectionPort); // Connect(Control, ControlIP, ConnectionPort); Display.RegisterHandler(MsgType.Disconnect, OnScreenDisconnect); Display.RegisterHandler(MsgType.Error, OnScreenError); Control.RegisterHandler(MsgType.Disconnect, OnControlDisconnect); Control.RegisterHandler(MsgType.Error, OnControlError); connectionConfig = new ConnectionConfig(); ListenServer(); // Dinlemeye başla user = new User(); question = new Question(); txtReceiveMsg.enabled = true; //Network.InitializeServer(10, 25000, false); }
void Start() { Screen.orientation = ScreenOrientation.Landscape; //Screen.fullScreen = true; networkOperations = new NetworkOperations(); ServerDev = new NetworkClient(); ServerDev.RegisterHandler(MsgType.Disconnect, OnServerDisconnect); networkOperations.Connect(ServerDev, NetworkOperations.ServerIP, NetworkOperations.ConnectionPort); ScreenDev = new NetworkClient(); ScreenDev.RegisterHandler(MsgType.Disconnect, OnScreenDisconnect); networkOperations.Connect(ScreenDev, NetworkOperations.DisplayIP, NetworkOperations.ConnectionPort); //Network.InitializeServer(10, 25000, true); ListenServer(); question = new Question(); user = new User(); user.animation.ID = -1; user.animation.Subject = "tanimsiz"; user.Answer = false; subjectSelect.enabled = false; QuestionAnswerCnv.enabled = false; Menu.enabled = true; }
protected override async Task ProcessRecordAsync() { var createResult = await DkrClient.Networks.CreateNetworkAsync(new NetworksCreateParameters() { Name = Name, Driver = Driver, Internal = Internal, CheckDuplicate = CheckDuplicate, EnableIPv6 = EnableIPv6, IPAM = IPAM, Options = Options, Labels = Labels }); if (!String.IsNullOrEmpty(createResult.Warning)) { WriteWarning(createResult.Warning); } if (!String.IsNullOrEmpty(createResult.ID)) { WriteObject(await NetworkOperations.GetNetworksById(createResult.ID, DkrClient)); } }
public void NetworkOperationsTest() { var networkOperations = Substitute.For <IPersistedNetworkOperations>(); var cachingNetworkOperations = new NetworkOperations(networkOperations); cachingNetworkOperations.Remove("1"); networkOperations.Get("1").Returns(TestDataCreator.Network("1", "key", "2", "3", "4", null)); var network = cachingNetworkOperations.Get("1"); Assert.AreEqual("2", network.ParentNetworkId); networkOperations.Received().Get("1"); networkOperations.ClearReceivedCalls(); var network2 = cachingNetworkOperations.Get("1"); Assert.AreEqual("2", network2.ParentNetworkId); networkOperations.DidNotReceive().Get("1"); }
protected override async Task ProcessRecordAsync() { if (Id != null) { foreach (var id in Id) { WriteObject(await NetworkOperations.GetNetworksById(id, DkrClient)); } } else if (Name != null) { foreach (var name in Name) { WriteObject(await NetworkOperations.GetNetworksByName(name, DkrClient)); } } else { foreach (var n in await DkrClient.Networks.ListNetworksAsync()) { WriteObject(n); } } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Operations = new Operations(this); Secret = new SecretOperations(this); SecretValue = new SecretValueOperations(this); Volume = new VolumeOperations(this); Network = new NetworkOperations(this); Gateway = new GatewayOperations(this); Application = new ApplicationOperations(this); Service = new ServiceOperations(this); ServiceReplica = new ServiceReplicaOperations(this); CodePackage = new CodePackageOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2018-09-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <SecretResourcePropertiesBase>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <SecretResourcePropertiesBase>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ApplicationScopedVolumeCreationParameters>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <ApplicationScopedVolumeCreationParameters>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <NetworkResourcePropertiesBase>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <NetworkResourcePropertiesBase>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <AutoScalingTrigger>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <AutoScalingTrigger>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <AutoScalingMechanism>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <AutoScalingMechanism>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DiagnosticsSinkProperties>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DiagnosticsSinkProperties>("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <AutoScalingMetric>("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <AutoScalingMetric>("kind")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); }
internal void Start() { string ApplicationPrefix = GlobalConfig.ProductName.ToUpperInvariant(); TraceDebug.Trace("Start {0}", GlobalConfig.ProductName); #if PORTABLE Environment.SetEnvironmentVariable(ApplicationPrefix + "_PORTABLE", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable(ApplicationPrefix + "_DRIVE", GlobalConfig.ApplicationDrive, EnvironmentVariableTarget.Process); #endif Environment.SetEnvironmentVariable(ApplicationPrefix + "_DATA", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process); messageID = NativeMethods.RegisterWindowMessage("KrentoStop"); //Do not localize!!! NativeMethods.AddRemoveMessageFilter(messageID, ChangeWindowMessageFilterFlags.Add); PrepareStandardProperties(); showSplashScreen = true; ApplyGUILanguage(); GlobalSettings.LoadGlobalSettings(); GlobalSettings.ManagerLeft = Settings.Default.ManagerLeft; GlobalSettings.ManagerTop = Settings.Default.ManagerTop; #region Parse command line foreach (string param in args) { if (TextHelper.SameText(param, @"/low")) { GlobalConfig.LowMemory = true; } if (TextHelper.SameText(param, @"/ns")) { showSplashScreen = false; } if (TextHelper.SameText(param, @"/nd")) { KrentoContext.SkipDocklets = true; } if (TextHelper.SameText(param, @"/nt")) { KrentoContext.SkipToys = true; } if (TextHelper.SameText(param, @"/desktop")) { KrentoContext.CreateDesktopCircle = true; } if (param.IndexOf(@".circle", StringComparison.OrdinalIgnoreCase) > 0) { KrentoContext.CircleParameter = param; } if (FileOperations.IsKrentoPackage(param)) { KrentoContext.PackageParameter = param; } } #endregion this.context = new KrentoContext(); #region FirstRun if (NativeMethods.GlobalCheckAtom("krento_first_run")) { KrentoContext.FirstRun = true; NativeMethods.GlobalKillAtom("krento_first_run"); } #if PORTABLE string firstRunFile = Path.Combine(GlobalConfig.ApplicationFolder, "first.run"); if (NativeMethods.FileExists(firstRunFile)) { KrentoContext.FirstRun = true; NativeMethods.FileDelete(firstRunFile); } #endif if (KrentoContext.FirstRun) { GlobalSettings.SaveGlobalSettings(); } #endregion #region First Instance if (context.FirstInstance) { if ((showSplashScreen) && GlobalSettings.ShowSplashScreen) { splashScreen = new SplashScreen(); } else { splashScreen = null; } this.mainForm = new MainForm(context); mainForm.Text = GlobalConfig.ProductName; InteropHelper.MainWindow = mainForm.Handle; if (showSplashScreen) { if (splashScreen != null) { mainForm.SplashScreen = splashScreen; } } if (NativeMethods.StartEngineEx(mainForm.Handle)) { if (GlobalSettings.ActivateServer) { if (NetworkOperations.PortAvailable(GlobalSettings.PortNumber)) { context.StartServer(); } } appContext = new ApplicationContext(); //Load plugins. If the instance is the first instance and //engine is activated, then plugins are loaded try { context.LoadKrentoPlugins(); } catch (Exception) { //do not stop on wrong plugins TraceDebug.Trace("Exception on loading Krento plugin"); } try { context.LoadKrentoToys(); } catch (Exception) { //do not stop on wrong plugins TraceDebug.Trace("Exception on loading Krento toy"); } try { context.LoadKrentoDocklets(); } catch { //do not stop on wrong docklet TraceDebug.Trace("Exception on loading docklet"); } NativeThemeManager.MakeSound("#110"); Application.Run(appContext); } } #endregion }