public virtual void RunSynchronized(IProgressScope progress) { foreach (var child in this.GetChildren()) { child.Task.RunSynchronized(progress); } }
public void BeginCreateDocument(TankInstance tank, IProgressScope progress, Action <CreateDocumentResult> callback) { Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { progress.ReportStatusMessage(this.L("stat_inspector", "status_analysing")); progress.ReportIsIndetermine(); this.LogInfo("creating document from template file '{0}'", this.Filename); var document = this.LoadTemplate(); progress.ReportProgress(0); var decendants = LogicalTreeHelperEx.GetDecendants <TextElement>(document).ToArray(); var statVms = new Dictionary <IStat, StatVM>(); var completedDecendant = 0; foreach (var decendant in decendants) { Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { var key = StatBehaviors.GetKey(decendant); if (key != null) { var stat = StatsProviderManager.Instance.GetStat(key); if (stat == null) { this.LogWarning("unknown stat: key='{0}'", key); return; } var statVm = statVms.GetOrCreate(stat, () => new StatVM(stat, tank)); decendant.DataContext = statVm; if (decendant is IAddChild) { this.ApplyTemplate(decendant); } ++completedDecendant; progress.ReportProgress((double)completedDecendant / decendants.Length); } }), DispatcherPriority.Background); } Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { progress.ReportIsIndetermine(); callback(new CreateDocumentResult(document, statVms.Values)); progress.ReportProgress(1.0); }), DispatcherPriority.Background); }), DispatcherPriority.Background); }
internal LocalGameClient(string rootPath, IProgressScope progress) { this.RootPath = rootPath; _paths = new LocalGameClientPath(this); this.ClientPaths = _paths.ClientPaths; this.CacheManager = new LocalGameClientCacheManager(this); this.Localization = new LocalGameClientLocalization(_paths.TextSettingsFile, _paths.TextFolder); this.Language = this.Localization.Language; this.PackageIndexer = new LocalGameClientPackageIndexer(this); this.PackageImages = new LocalGameClientPackageImage(_paths); this.LoadConfig(); this.LoadXml(); Application.Current.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
private void Run(IProgressScope progress) { var service = DocumentServiceManager.Instance.GetDocumentServiceOrNotifyMissing(_uri.Scheme); if (service == null) { return; } var existedDocument = _documentManager.Documents.FirstOrDefault(d => d.Uri == _uri); if (existedDocument != null) { _documentManager.SelectDocument(existedDocument); this.DocumentInfo = existedDocument; return; } _createDocumentTask = service.CreateCreateDocumentTask(_uri, _guid, _persistentInfo); if (_createDocumentTask == null) { this.LogWarning("create document failed for '{0}' (Guid='{1}'), unable to create the document creation task", _uri, _guid); return; } _createDocumentTask.RunSynchronized(progress); if (this.DocumentInfo != null) { return; } this.DocumentInfo = _createDocumentTask.DocumentInfo; if (this.DocumentInfo == null) { this.LogWarning("create document failed for '{0}' (Guid='{1}')", _uri, _guid); return; } _documentManager.OpenDocument(this.DocumentInfo); }
public static void SetScope(DependencyObject obj, IProgressScope value) { obj.SetValue(ScopeProperty, value); }
protected override BitmapSource[] CaptureFrames(ISnapshotProvider snapshotProvider, Rect clippingRectangle, Color shadeColor, IProgressScope progress, Func <bool> getIsCancelled) { var frame1 = this.PrintVersionTag(snapshotProvider.Snapshot(clippingRectangle, this.SampleFactor, shadeColor), this.Owner.Owner.TankInstance); var frame2 = this.PrintVersionTag(this.Owner.Owner.AlternativeSnapshotProvider.Snapshot(clippingRectangle, this.SampleFactor, shadeColor), this.Owner.Owner.AlternativeTankInstance); return(new[] { frame1, frame2 }); }
private void DoInitializeModules(IProgressScope progress) { progress.ReportStatusMessage("Initializing modules..."); base.InitializeModules(); }
public void RunSynchronized(IProgressScope progress) { _action(progress); }
public void PostProcess(IProgressScope progress) { }
public void PreProcess(IProgressScope progress) { this.DocumentInfo = _factory(progress); }
public override void PreProcess(IProgressScope progress) { base.PreProcess(progress); progress.ReportStatusMessage(this.L("document", "status_loading_documents")); }
public void RunSynchronized(IProgressScope progress) { this.Run(progress); }
public void PreProcess(IProgressScope progress) { progress.ReportStatusMessage(this.L("document", "status_opening_document", _uri.ToString())); this.Run(progress); }
public virtual void PreProcess(IProgressScope progress) { }
public void RunSynchronized(IProgressScope progress) { this.DocumentInfo = _factory(progress); }
public override void PreProcess(IProgressScope progress) { base.PreProcess(progress); progress.ReportStatusMessage(this.L("game_client_manager", "status_loading_game_clients")); }
protected override BitmapSource[] CaptureFrames(ISnapshotProvider snapshotProvider, Rect clippingRectangle, Color shadeColor, IProgressScope progress, Func <bool> getIsCancelled) { return(snapshotProvider.YawAnimationSnapshot(clippingRectangle, this.SampleFactor, shadeColor, this.RotationSpeed, this.AnimationFramerate, progress, getIsCancelled)); }
protected abstract BitmapSource[] CaptureFrames(ISnapshotProvider snapshotProvider, Rect clippingRectangle, Color shadeColor, IProgressScope progress, Func <bool> getIsCancelled);
public void PreProcess(IProgressScope progress) { _action(progress); }
public IProgressScope StartProgress() { return(ProgressScope = new ProgressScope()); }