コード例 #1
0
 public virtual void RunSynchronized(IProgressScope progress)
 {
     foreach (var child in this.GetChildren())
     {
         child.Task.RunSynchronized(progress);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
                }
コード例 #5
0
 public static void SetScope(DependencyObject obj, IProgressScope value)
 {
     obj.SetValue(ScopeProperty, value);
 }
コード例 #6
0
        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 });
        }
コード例 #7
0
 private void DoInitializeModules(IProgressScope progress)
 {
     progress.ReportStatusMessage("Initializing modules...");
     base.InitializeModules();
 }
コード例 #8
0
 public void RunSynchronized(IProgressScope progress)
 {
     _action(progress);
 }
コード例 #9
0
 public void PostProcess(IProgressScope progress)
 {
 }
コード例 #10
0
 public void PreProcess(IProgressScope progress)
 {
     this.DocumentInfo = _factory(progress);
 }
コード例 #11
0
 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);
 }
コード例 #14
0
 public virtual void PreProcess(IProgressScope progress)
 {
 }
コード例 #15
0
 public void RunSynchronized(IProgressScope progress)
 {
     this.DocumentInfo = _factory(progress);
 }
コード例 #16
0
 public override void PreProcess(IProgressScope progress)
 {
     base.PreProcess(progress);
     progress.ReportStatusMessage(this.L("game_client_manager", "status_loading_game_clients"));
 }
コード例 #17
0
 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));
 }
コード例 #18
0
 protected abstract BitmapSource[] CaptureFrames(ISnapshotProvider snapshotProvider, Rect clippingRectangle, Color shadeColor, IProgressScope progress, Func <bool> getIsCancelled);
コード例 #19
0
 public void PreProcess(IProgressScope progress)
 {
     _action(progress);
 }
コード例 #20
0
ファイル: ProgressProvider.cs プロジェクト: praktii/cappuchat
 public IProgressScope StartProgress()
 {
     return(ProgressScope = new ProgressScope());
 }