/// <summary> /// Look for updates while displaying a progress bar. At the end display a message box with the result. /// </summary> public static void LookForUpdates() { var result = UpdateSystem.UpdateStatus.CheckFailed; var error = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleSearchingForUpdates, x => { result = UpdateSystem.CheckForUpdates(); }); if (error == null) { switch (result) { case UpdateSystem.UpdateStatus.CheckFailed: MessageBoxes.UpdateFailed(UpdateSystem.LastError != null ? UpdateSystem.LastError.Message : "Unknown error"); break; case UpdateSystem.UpdateStatus.NewAvailable: AskAndBeginUpdate(); break; case UpdateSystem.UpdateStatus.UpToDate: MessageBoxes.UpdateUptodate(); break; } } else { MessageBoxes.UpdateFailed(error.Message); } }
/// <summary> /// Automatically search for updates if auto update is enabled. /// Doesn't block, use delegates to interface. /// </summary> /// <param name="canDisplayMessage">updateFoundCallback will be called after this returns true</param> /// <param name="updateFoundCallback">Launched only if a new update was found. It's launched from a background thread.</param> public static void AutoUpdate(Func <bool> canDisplayMessage, Action updateFoundCallback) { if (Settings.Default.MiscCheckForUpdates && WindowsTools.IsNetworkAvailable()) { new Thread(() => { if (UpdateSystem.CheckForUpdates() != UpdateSystem.UpdateStatus.NewAvailable) { return; } while (!canDisplayMessage()) { Thread.Sleep(100); } try { updateFoundCallback(); } catch { // Ignore background error, not necessary } }) { Name = "UpdateCheck_Thread", IsBackground = true }.Start(); } }
void Callback(IAsyncResult ar) { try { task.EndInvoke(ar); } catch (Exception e) { UnityEngine.Debug.LogException(e); } try { if (onAnyThreadTrigger != null) { onAnyThreadTrigger(); } } catch (Exception e) { UnityEngine.Debug.LogException(e); } try { if (this.onUnityThreadTrigger != null) { while (!UpdateSystem.AddUnityThreadCallbackToQueue(this)) { ; } } } catch (Exception e) { UnityEngine.Debug.LogException(e); } }
void Callback(IAsyncResult ar) { secondThread.EndInvoke(ar); while (!UpdateSystem.AddUnityThreadCallbackToQueue(this)) { ; } }
private void OnForceState(ForceStateChange forceState) { var datas = turretHub.Data.TurretsDatas; foreach (var kvp in datas) { UpdateSystem.SendEvent(new BaseUnitStatus.ForceState.Event(forceState), kvp.Value.EntityId); } }
private void HandleEvents() { var updatesEvents = UpdateSystem.GetEventsReceived <WorldTimer.Updates.Event>(); if (updatesEvents.Count > 0) { var i = UnityEngine.Random.Range(0, updatesEvents.Count); var timerEvent = updatesEvents[i]; UpdateCurrent(timerEvent.Event.Payload.CurrentSeconds); } }
void OnDisable() { m_SynthesizerProvider = null; UpdateSystem.Ignore <PreLateUpdate>(OnPreLateUpdate); Camera.onPostRender -= OnRender; RenderPipelineManager.endCameraRendering -= OnRenderRP; EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; }
public void GroupInjecting() { var context = ContextFactory.CreateEntitiesContext(); var systemManager = context.GetManager <SystemManager>(); var system = new UpdateSystem(); systemManager.AddSystem(system); Assert.NotNull(system.Group); }
public static void Restart() { try { UpdateSystem.RestartApplication(); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } }
private void OnOrderUpdate(OrderType order) { var datas = turretHub.Data.TurretsDatas; foreach (var kvp in datas) { UpdateSystem.SendEvent(new BaseUnitStatus.SetOrder.Event(new OrderInfo() { Order = order }), kvp.Value.EntityId); } }
public void AddEnabledUpdateSystem() { var context = ContextFactory.CreateEntitiesContext(); var systemManager = context.GetManager <SystemManager>(); var system = new UpdateSystem(); systemManager.AddSystem(system); Assert.AreEqual(1, systemManager.systems.Count); Assert.AreEqual(1, systemManager.updateSystems.Count); }
public static void Restart() { try { IsRestarting = true; UpdateSystem.RestartApplication(); } catch (Exception ex) { PremadeDialogs.GenericError(ex); IsRestarting = false; } }
/// <summary> /// 从云上拉去数据到内存中 /// </summary> private void RequestAccountAndChapters() { if (NetSystem.Instance.GetConnector().GetConnectStatus() == ConnectionStatus.CONNECTED) { string objectName = LocalAccountStorage.Get().account + ".txt"; string filePath = UpdateSystem.Get().saveRoot + objectName; NetSystem.Instance.helper.GenPresignedUrl(objectName, "GET", "text/plain", filePath, (int)EventId.OnSyncUserAndChapters); } else { StartSingleGame(); } }
private void button4_Click(object sender, EventArgs e) { MessageBox.Show(UpdateSystem.CheckForUpdates().ToString()); if (UpdateSystem.LastError != null) { MessageBox.Show(UpdateSystem.LastError.Message); } if (UpdateSystem.LatestReply != null) { MessageBox.Show(UpdateSystem.LatestReply.FullReply.ToString()); labelVersion.Text = UpdateSystem.LatestReply.GetUpdateVersion().ToString(); } }
private static void SetupDependancies() { // Order is semi-important, prepare settings should go first. Program.PrepareSettings(); CultureConfigurator.SetupCulture(); try { UpdateSystem.ProcessPendingUpdates(); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } }
protected override void Initialize() { if (editorEnabled) { startEditor?.Invoke(); } renderSystem = new RenderSystem(GraphicsDevice); renderSystem.Initialize(); updateSystem = new UpdateSystem(); updateSystem.Initialize(); drawableSystems.Add("RenderSystem", renderSystem); updateableSystems.Add("UpdateSystem", updateSystem); base.Initialize(); }
private void HandleEvets() { var controllerEvents = UpdateSystem.GetEventsReceived <AdvancedUnitController.ControllerChanged.Event>(); for (var i = 0; i < controllerEvents.Count; i++) { var ctrlEvent = controllerEvents[i]; AdvancedUnitController.Component?comp = null; if (TryGetComponent(ctrlEvent.EntityId, out comp)) { var value = comp.Value; value.Controller = ctrlEvent.Event.Payload; SetComponent(ctrlEvent.EntityId, value); } } }
private void HandleLaserFireInfoEvents() { var laserFireEvents = UpdateSystem.GetEventsReceived <LongRangeLaserComponent.LaserFired.Event>(); for (var i = 0; i < laserFireEvents.Count; i++) { var laser = laserFireEvents[i]; var id = laser.EntityId.Id; if (laserContainer.ContainsKey(id) == false) { laserContainer.Add(id, new LaserContainer(id)); } var container = laserContainer[id]; container.AddLaser(laser.Event.Payload); } }
public MainWindow() { InitializeComponent(); Editor.API.NotificationSystem.Initialize(UI_DockPanel_Notification, UI_DockPanel_Notification_Translate); UpdateSystem.Initialize(); Navegation.NavegationMenu = navegationBar; Navegation.TabControl = UI_TabControl; PluginEngine.Initialize(); //PluginManager pluginManager = new PluginManager(); // Internal.System.Initialize(); // NavegationBar = this.navegationBar; // Main = this; InitializeUI(); }
/// <summary> /// 加载streaming资源 /// 仅仅是获取了正确的资源路径,仍然使用外部读取手段 /// </summary> /// <param name="relativePath">Relative path.</param> public string LoadStramingAsset(string relativePath) { object asset = null; #if !SERVER if (UpdateSystem.Get().HaveAssetBundle()) { UpdateSystem.Get().LoadStreamingAssets(relativePath, out asset); } #endif if (asset == null) { return(DataProviderSystem.FormatDataProviderPath(relativePath)); } return((string)asset); }
/// <summary> /// 读取资源 /// </summary> /// <returns>The resource.</returns> /// <param name="path">Path.</param> public Object LoadResource(string path) { object asset = null; #if !SERVER if (UpdateSystem.Get().HaveAssetBundle()) { UpdateSystem.Get().LoadAsset(path, out asset); } if (asset == null) { asset = Resources.Load(path); } #endif return((Object)asset); }
void OnEnable() { m_SynthesizerProvider = null; LoadTemplate(); EditorApplication.playModeStateChanged += OnPlayModeStateChanged; //For regular RP Camera.onPostRender -= OnRender; Camera.onPostRender += OnRender; //For HDRP RenderPipelineManager.endCameraRendering -= OnRenderRP; RenderPipelineManager.endCameraRendering += OnRenderRP; UpdateSystem.Listen <PreLateUpdate>(OnPreLateUpdate); m_ExitingPlayMode = false; }
public static void AskAndBeginUpdate() { if (MessageBoxes.UpdateAskToDownload()) { try { // Prevent log cleaner from running in portable builds EntryPoint.IsRestarting = true; UpdateSystem.BeginUpdate(); } catch (Exception ex) { EntryPoint.IsRestarting = false; Console.WriteLine(ex); MessageBoxes.UpdateFailed(ex.Message); } } }
protected override bool OnStartup(StartupEventArgs eventArgs) { // Order is semi-important, prepare settings should go first. Program.PrepareSettings(); NBugConfigurator.SetupNBug(); CultureConfigurator.SetupCulture(); try { UpdateSystem.ProcessPendingUpdates(); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } // Necessary to put form constructor here for objectlistbox. It flips out if // the main form is created inside of the EntryPoint constructor. MainForm = new MainWindow(); return(true); }
public void DisableUpdateSystem() { var context = ContextFactory.CreateEntitiesContext(); var systemManager = context.GetManager <SystemManager>(); var system = new UpdateSystem(); system.IsEnabled = true; systemManager.AddSystem(system); context.Update(); Assert.AreEqual(1, systemManager.systems.Count); Assert.AreEqual(1, systemManager.updateSystems.Count); Assert.IsTrue(system.Updated); system.Updated = false; system.IsEnabled = false; context.Update(); Assert.AreEqual(1, systemManager.systems.Count); Assert.AreEqual(0, systemManager.updateSystems.Count); Assert.IsFalse(system.Updated); }
public MainWindow() { updateSystem = new UpdateSystem("0.1.0"); settings = new Settings(); InitializeComponent(); }
public WorldVisualizerFactory(UpdateSystem updateSystem) { this.updateSystem = updateSystem; }
public WorldVisualizerFactory() { updateSystem = UpdateSystem.Presentation; }
private void button3_Click(object sender, EventArgs e) { UpdateSystem.BeginUpdate(); }
public void AddSystem(UpdateSystem system) { _updateSystems.Add(system); }
public void RemoveSystem(UpdateSystem system) { _updateSystems.Remove(system); }