public void Dispose() { _instance = null; _stats = null; _task = null; _timer.Dispose(); _timer = null; }
public DownloadProgress(ParallelTasks.Task task, Stats stats) : base(MyStringId.NullOrEmpty, null, beginAction, endAction) { Logger.WriteLine("entered"); FriendlyName = typeof(DownloadProgress).Name; _instance = this; _stats = stats; _task = new TaskWrapper(task); _timer = new Timers.Timer(100d); _timer.Elapsed += Update; _timer.Start(); }
/// <summary> /// Initialize this object. /// </summary> /// <param name="gameInstance">MySandboxGame.Static, so I don't know why it's a param</param> public void Init(object gameInstance = null) { if (_instance != this) { return; } _initialized = true; if (!_task.IsComplete && !Game.IsDedicated) { // bug in Torch: DownloadProgress progress; try { progress = new DownloadProgress(_task, _downProgress); } catch (Exception ex) { Logger.WriteLine("Game is not dedicated but download screen cannot be created. Exception:\n" + ex); return; } Logger.WriteLine("Opening download screen"); MyGuiSandbox.AddScreen(progress); } }