//bool bstate = true; public frmManager() { InitializeComponent(); SystemController sc = new SystemController(); pm = PackageManager.GetInstance(); bm = BoxsManager.GetInstance(); enu = bm.BoxsDictionary.GetEnumerator(); dataGridView1.AllowUserToAddRows = false; DataGridViewDisableButtonColumn openCol = new DataGridViewDisableButtonColumn(); openCol.Name = "open"; DataGridViewDisableButtonColumn deletePackageCol = new DataGridViewDisableButtonColumn(); deletePackageCol.Name = "deletePackage"; DataGridViewDisableButtonColumn boxStateCol = new DataGridViewDisableButtonColumn(); boxStateCol.Name = "boxState"; dataGridView1.Columns.Add(openCol); dataGridView1.Columns.Add(deletePackageCol); dataGridView1.Columns.Add(boxStateCol); Initialize(); UpdateData(); }
/// <summary> /// Attach to other AppDomain. /// </summary> /// <returns>WindowsAppFriend for manipulation.</returns> #else /// <summary> /// 現在操作しているAppDomain以外にアタッチ /// </summary> /// <returns>操作するためのWindowsAppFriend</returns> #endif public WindowsAppFriend[] AttachOtherDomains() { var ctrl = Dim(new NewInfo("Codeer.Friendly.Windows.Step.AppDomainControl", DllInstaller.CodeerFriendlyWindowsNativeDllPath)); var ids = (int[])ctrl["EnumDomains"]().Core; if (ids == null) { throw new NotSupportedException(ResourcesLocal.Instance.ErrorAttachOtherDomainsNeedNet4); } var ws = new List <WindowsAppFriend>(); for (int i = 0; i < ids.Length; i++) { int id = ids[i]; if (id == (int)this[typeof(AppDomain), "CurrentDomain"]()["Id"]().Core) { continue; } var executeContextWindowHandle = _context.FriendlyConnector.FriendlyConnectorWindowInAppHandle; SystemController system = SystemStarter.StartInOtherAppDomain(ProcessId, executeContextWindowHandle, e => ctrl["InitializeAppDomain"](id, e)); ws.Add(new WindowsAppFriend(system, executeContextWindowHandle, _processId)); } return(ws.ToArray()); }
//销毁实例 public static void DestoryInstance() { if (instance != null) { instance = null; } }
public PageInfo <ViewSystemAction> GetPageList(PageInfo <ViewSystemAction> pageInfo, ViewSystemAction oSearchEntity = null, string sOperator = null, int iOrderGroup = 0, string sSortName = null, string sSortOrder = null) { if (!string.IsNullOrWhiteSpace(oSearchEntity.ScontrollerName)) { SystemController entitySystemController = _systemControllerService.Select(new SystemController() { ScontrollerName = oSearchEntity.ScontrollerName }); if (entitySystemController != null) { oSearchEntity.IcontrollerId = entitySystemController.Id; pageInfo = _mapper.Map <PageInfo <ViewSystemAction> >(_systemActionRepository.GetPageList(_mapper.Map <PageInfo <SystemAction> >(pageInfo), _mapper.Map <SystemAction>(oSearchEntity), sOperator, iOrderGroup, sSortName, sSortOrder)); } } else { pageInfo = _mapper.Map <PageInfo <ViewSystemAction> >(_systemActionRepository.GetPageList(_mapper.Map <PageInfo <SystemAction> >(pageInfo), _mapper.Map <SystemAction>(oSearchEntity), sOperator, iOrderGroup, sSortName, sSortOrder)); } if (pageInfo.data?.Count > 0) { foreach (var entity in pageInfo.data) { SystemController entitySystemController = _systemControllerService.Select(entity.IcontrollerId); if (entitySystemController != null) { entity.ScontrollerName = entitySystemController.ScontrollerName; entity.SactionName = "/" + entitySystemController.ScontrollerName + "/" + entity.SactionName + "?iMethodId=" + entity.Id; } } } return(pageInfo); }
private void GamepadAdded(object sender, Gamepad gamepad) { _gamepad = gamepad; Task.Factory.StartNew(() => { StartGamepadReading(gamepad).Wait(); }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default) .AsAsyncAction() .AsTask() .ContinueWith((t) => { Logger.Write($"{nameof(Gamepad)}, {nameof(StartGamepadReading)}: ", t.Exception).Wait(); SystemController.ShutdownApplication(true).Wait(); }, TaskContinuationOptions.OnlyOnFaulted); Task.Factory.StartNew(() => { StartGamepadVibration(gamepad).Wait(); }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default) .AsAsyncAction() .AsTask() .ContinueWith((t) => { Logger.Write($"{nameof(Gamepad)}, {nameof(StartGamepadVibration)}: ", t.Exception).Wait(); SystemController.ShutdownApplication(true).Wait(); }, TaskContinuationOptions.OnlyOnFaulted); }
private void InitControllers() { sysController = new SystemController(this); extController = new ExtensionController(this); AddController(0, sysController); AddController(1, extController); }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="controller">システムコントローラ</param> /// <param name="executeContextWindowHandle">処理実行するスレッドに属するウィンドウハンドル</param> /// <param name="processId">プロセスId</param> WindowsAppFriend(SystemController controller, IntPtr executeContextWindowHandle, int processId) { _systemController = controller; _processId = processId; _context = new ExecuteContext(_systemController.StartFriendlyConnector(executeContextWindowHandle)); ResourcesLocal.Install(this); }
public IActionResult DatabaseCheck(string id) { //prevent start wizard if already passed if (!bool.Parse(configuration["FirstRun"])) { return(View("Error", ALREADY_PASSED_MESSAGE)); } if (id == "Delete") { SystemController.ClearAllDatabases(); return(RedirectToAction("Gateway")); } if (id == "Use") { return(RedirectToAction("Gateway")); } if ((SystemController.nodesDb.GetAllNodes() != null && SystemController.nodesDb.GetAllNodes().Count != 0) || (SystemController.usersDb.GetUsersCount() != 0)) { return(View("DatabaseIsNotEmpty")); } return(RedirectToAction("Gateway")); }
void Start() { //Check requered objects systemControllerGameObject = GameObject.Find("Controllers"); systemController = systemControllerGameObject.GetComponent <SystemController>(); if (systemControllerGameObject == null) { throw new Exception("systemController is null"); } if (systemController == null) { throw new Exception("systemController is null"); } if (systemController == null) { throw new Exception("systemController is null"); } if (introAnimation == null) { throw new Exception("Requered Animation"); } if (introAnimation.GetClipCount() == 0) { throw new Exception("No clips in Animation"); } if (introAnimation.playAutomatically == false) { throw new Exception("Animation.playAutomatically == false"); } }
void Start() { systemController = GameObject.Find("Manager").GetComponent <SystemController>(); panelMainMenu.CheckExist(); panelSureQuit.CheckExist(); panelExamples.CheckExist(); }
public async Task <string> AddOrModifyAsync([FromForm] SystemController model) { BaseResult baseResult = new BaseResult(); try { if (model != null) { if (!string.IsNullOrWhiteSpace(model.ScontrollerName)) { if (await _SystemControllerService.AddOrModifySystemControllerAsync(model, User.Identity.Name) != null) { baseResult.Code = 0; baseResult.Msg = "操作成功!"; } else { baseResult.Code = 1; baseResult.Msg = "操作失败!"; } } else { baseResult.Code = 3; baseResult.Msg = "控制器名称不能为空!"; } } } catch (Exception ex) { baseResult.Code = 3; baseResult.Msg = ex.Message; } return(JsonHelper.ObjectToJSON(baseResult)); }
public Star(SystemController controller, int seed, GameObject gameObject) : base(controller, gameObject, seed, new CelestialType.Star()) { MeshFilter filter = gameObject.AddComponent <MeshFilter>(); MeshRenderer renderer = gameObject.AddComponent <MeshRenderer>(); filter.mesh = Octahedron.Create(5, radius); Material mat = new Material(controller.materialController.starMaterial); CelestialType starType = new CelestialType.Star(); mat.SetInt("_Temp", (int)Utility.GetRandomBetween(new System.Random(seed), starType.minTemperature, starType.maxTemperature)); renderer.material = mat; renderer.receiveShadows = false; renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; gameObject.transform.localScale = Vector3.one; var light = gameObject.AddComponent <Light>(); light.type = LightType.Point; light.range = 2000000; light.bounceIntensity = 0; light.renderMode = LightRenderMode.ForcePixel; light.intensity = 1; light.shadows = LightShadows.Soft; light.shadowNearPlane = .1f; }
public void Init(SystemController controller, CelestialBody planet) { this.controller = controller; this.planet = planet; random = new System.Random(planet.seed); Material mat = new Material(controller.materialController.ringMaterial); //set shader variables mat.SetColor("_Color1", Utility.GetRandomColorInHSVRange(random, 0.1f, 0.1f, 0, 1, 0, 1)); mat.SetColor("_Color2", Utility.GetRandomGrayColor(random)); mat.SetTexture("_MainTex", GetRingTexture()); mat.SetVector("_PlanetPosition", planet.position); mat.SetFloat("_PlanetRadius", planet.radius); mat.SetFloat("_Frequency", (float)Utility.GetRandomBetween(random, 15, 50)); gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; gameObject.AddComponent <MeshRenderer>().material = mat; gameObject.AddComponent <MeshFilter>().mesh = GetRingMesh(); //copy and rotate 180 to see the backside GameObject copy = Instantiate(gameObject); copy.transform.parent = gameObject.transform; copy.transform.localPosition = Vector3.zero; copy.transform.localRotation = Quaternion.Euler(180, 0, 0); copy.transform.localScale = Vector3.one; }
public IActionResult GatewayEthernet(EthernetGatewayViewModel model) { //prevent start wizard if already passed if (!bool.Parse(configuration["FirstRun"])) { return(View("Error", ALREADY_PASSED_MESSAGE)); } //redirect to first step if user came this url directly if (SystemController.dataBaseConfig == null) { return(RedirectToAction("Index")); } dynamic json = ReadConfig(); json.Gateway.EthernetGateway.GatewayIP = model.Ip; json.Gateway.EthernetGateway.GatewayPort = model.Port; json.Gateway.SerialGateway.Enable = false; json.Gateway.EthernetGateway.Enable = true; WriteConfig(json); configuration.Reload(); SystemController.DisconnectGateway(); SystemController.ReadConfig(); SystemController.ConnectToGateway(); return(RedirectToAction("UserProfile")); }
public async Task GivenNoParams_WhenGetSystemInfo_ThenGetSystemInfoCommandSent_AndResponseReturned() { // Arrange var mockMediator = new Mock <IMediator>(); var sut = new SystemController( mockMediator.Object, Mock.Of <ILogger <SystemController> >()); var response = new GetSystemInfoResponse { SystemInfo = new Dto.Response.SystemInfo { StartedAt = DateTime.UtcNow.Subtract(new TimeSpan(1, 0, 0)) } }; mockMediator.Setup(x => x.Send <GetSystemInfoResponse>( It.IsAny <IRequest <GetSystemInfoResponse> >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(response)); // Act var result = await sut.GetSystemInfo(); // Assert mockMediator.Verify(x => x.Send <GetSystemInfoResponse>( It.IsAny <IRequest <GetSystemInfoResponse> >(), It.IsAny <CancellationToken>()), Times.Once); Assert.True(result.Success); Assert.Equal(response.SystemInfo, result.Value); }
private void CheckEndGame() { var player1 = SystemController.GetSystem <OperativeInfoSystem>().GetEntitiesByOwner(PlayerType.Player1).Count; var player2 = SystemController.GetSystem <OperativeInfoSystem>().GetEntitiesByOwner(PlayerType.Player2).Count; if (player1 == 0 || player2 == 0) { PlayerType?winner = null; if (player1 == 0 && player2 == 0) { Debug.Log("Draw"); } else if (player1 == 0) { winner = PlayerType.Player2; Debug.Log("player2 wins!"); } else if (player2 == 0) { winner = PlayerType.Player1; Debug.Log("player1 wins!"); } Messages.SendEvent(new PlayerWinMsg(winner)); } }
public void ProducePhase() { //TODO 10!! if (_currentPhase == 10) { _currentPhase = 0; SystemController.OnUpdateEnd(); CheckEndGame(); Messages.SendEvent(EventStrings.OnNextTurn); return; } foreach (var actionPhase in _turnData) { foreach (var dto in actionPhase.dtos) { if (dto.StartTick == _currentPhase) { SystemController.ProcessData(actionPhase.entityId, dto.ToComponentBase()); } } } ++_currentPhase; StartCoroutine(WaitForNextIteration()); }
public RockPlanet(SystemController controller, GameObject gameObject, int seed, CelestialBody host = null) : base(controller, gameObject, seed, new CelestialType.RockPlanet(), host) { System.Random random = new System.Random(seed); rockColor1 = Utility.GetRandomColorInHSVRange(random, 10f / 360f, 30f / 360f, 0f, 0.8f, 0.4f, 0.9f); rockColor2 = Utility.GetRandomColorInHSVRange(random, 0f / 360f, 30f / 360f, 0f, 0.8f, 0.4f, 0.9f); GenerateCraters(80, radius / 25f, radius / 5f); }
public void ControllerTest() { //Init SystemController.GetInstance().ChangeRefreshStrategy(new ManualRefresh()); Counter.GetInstance().ChangeMathModel(new LogisticModel()); Species fox = new Species("fox", 10, 3, 1, 200); Ecosystem.GetInstance().AddSpecies(fox); SystemController.GetInstance().ExecuteRefresh(); SystemController.GetInstance().StopRefresh(); Assert.AreEqual(29, fox.Population); Species rabbit = new Species("rabbit", 30, 3, 1, 500); Ecosystem.GetInstance().AddSpecies(rabbit); rabbit.Relations[0] = -1; Counter.GetInstance().ChangeMathModel(new N_SpaciesModel_General()); SystemController.GetInstance().ExecuteRefresh(); Assert.AreEqual(87, fox.Population); Assert.AreEqual(0, rabbit.Population); Ecosystem.GetInstance().Species.Clear(); History.GetInstance().Data.Clear(); }
public void TestSystemControllerConstructor() { SystemController sc1 = new SystemController(); Assert.IsNotNull(sc1); Assert.IsInstanceOf <SystemController>(sc1); }
public IcePlanet(SystemController controller, GameObject gameObject, int seed, CelestialBody host = null) : base(controller, gameObject, seed, new CelestialType.IcePlanet(), host) { GenerateCraters(30, radius / 25f, radius / 5f); snowColor = Color.white; System.Random random = new System.Random(seed); dirtColor = Utility.GetRandomColorInHSVRange(random, 30f / 360f, 40f / 360f, 0.4f, 0.7f, 0.6f, 0.9f); rockColor = new Color32(159, 165, 168, 255); }
//获取实例 public static SystemController GetInstance() { if (instance == null) { instance = new SystemController(); } return(instance); }
static void Main(string[] args) { ILineSystem lineSystem = new LineSystem(); ILineSystemUI ui = new LineSystemCLI("Console UI", lineSystem); SystemController sc = new SystemController(ui, lineSystem); ui.Start(); }
private void CoreApplication_Exiting(object sender, object e) { try { SystemController.StopAll().Wait(); } catch (Exception) { } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); Controller = new SystemController(); }
public MoltenPlanet(SystemController controller, GameObject gameObject, int seed, CelestialBody host = null) : base(controller, gameObject, seed, new CelestialType.MoltenPlanet(), host) { waterLevel = 1f; System.Random random = new System.Random(seed); surfColor1 = Utility.GetRandomColorInHSVRange(random, 0, 0, 0, 0, 0.2f, 0.3f); surfColor2 = Utility.GetRandomColorInHSVRange(random, 0, 0, 0.6f, 1, 0.3f, 0.8f); GenerateCraters(50, radius / 25f, radius / 5f); }
private void Awake() { logger = GameObject.FindObjectOfType <Logger>(); systemController = GameObject.FindObjectOfType <SystemController>(); systemController.DeviceOrientationChanged += OnDeviceOrientationChanged; car = GameObject.Find("Tocus"); carAnim = car.GetComponent <Animator>(); }
/// <summary> /// It is a constructor. Used to take over connection information. /// </summary> /// <param name="executeContextWindowHandle"> /// Windowshandle that belongs to the target process. /// Operations are carried out in the thread of this window. /// <param name="bin">Connection information serialized binary.</param> #else /// <summary> /// コンストラクタです。接続情報を引き継ぐときに使います。 /// </summary> /// <param name="executeContextWindowHandle">接続対象プロセスの処理実行スレッドのウィンドウハンドル。</param> /// <param name="bin">接続情報がシリアライズされたバイナリ。</param> #endif public WindowsAppFriend(IntPtr executeContextWindowHandle, byte[] bin) { ResourcesLocal.Initialize(); ProtocolMessageManager.Initialize(); _systemController = (SystemController)SerializeUtility.Deserialize(bin); _context = new ExecuteContext(_systemController.StartFriendlyConnector(executeContextWindowHandle)); NativeMethods.GetWindowThreadProcessId(executeContextWindowHandle, out _processId); }
/// <summary> /// Constructs an initial update performer. /// </summary> /// <param name="cache">The configuration cache that will receive the channel and directory counts.</param> /// <param name="directories">The controller set for accessing directory controllers.</param> /// <param name="system">The system controller.</param> /// <param name="config">The config controller.</param> public InitialUpdatePerformer(ConfigCache?cache, DirectoryControllerSet?directories, SystemController?system, ConfigController?config) { _cache = cache ?? throw new ArgumentNullException(nameof(cache)); _directories = directories ?? throw new ArgumentNullException(nameof(directories)); _system = system ?? throw new ArgumentNullException(nameof(system)); _config = config ?? throw new ArgumentNullException(nameof(config)); }
public override void startWindow() { base.startWindow(); systemController = SystemController.get(); gameObject.SetActive(true); dataController = new UserInfoController(); startWait(); dataController.requestUserInfo(onReceivedUserInfo); }
/// <summary> /// Constructor. /// </summary> /// <param name="app">Application manipulation object.</param> /// <param name="executeThreadWindowHandle">Window handle in the thread where test operations will be carried out.</param> #else /// <summary> /// コンストラクタ。 /// </summary> /// <param name="app">アプリケーション操作クラス。</param> /// <param name="executeThreadWindowHandle">処理を実行させるスレッドで動作するウィンドウのハンドルです。</param> #endif public ExecuteContext(WindowsAppFriend app, IntPtr executeThreadWindowHandle) { if (app == null) { throw new ArgumentNullException("app"); } _systemController = app.SystemController; _friendlyConnector = _systemController.StartFriendlyConnector(executeThreadWindowHandle); }
public static SystemController get() { if (instance == null) { instance = new SystemController(); } return instance; }
void Start() { radians = 0f; sphereCollider = GetComponent<SphereCollider> (); rb = GetComponent<Rigidbody> (); anim = GetComponent<Animator> (); sys = GameObject.Find ("SystemController").GetComponent<SystemController> (); render = GetComponent<Renderer> (); }
public virtual void Awake() { moveDes = transform.position; sys = GameObject.FindGameObjectWithTag ("SystemController").GetComponent<SystemController> (); source = GetComponent<AudioSource> (); }
public override void startGame() { base.startGame(); systemController = SystemController.get(); connection = Connection.getInstance(); myCallback = UnityEngine.Random.Range(0, 100); registerListeners(); requestUsersList(); }
void Awake() { sys = GameObject.FindGameObjectWithTag ("SystemController").GetComponent<SystemController> (); }