コード例 #1
0
 private void PresentatieGereedmeldingCallback(string opgeslagenAlsBestand = null, string foutmelding = null, int?slidesGemist = null)
 {
     if (Status == GeneratorStatus.Gestopt)
     {
         return;
     }
     Status = GeneratorStatus.Gestopt;
     _setGereedmelding?.Invoke(opgeslagenAlsBestand, foutmelding, slidesGemist);
 }
コード例 #2
0
        public void StopGenerate()
        {
            lock (this)
            {
                if (_generatorStatus == GeneratorStatus.Started)
                {
                    _generatorStatus = GeneratorStatus.StopPending;

                    // atnaujina UI būseną
                    FireStatusChangedEvent(_generatorStatus);
                }
            }
        }
コード例 #3
0
        private void EndGenerate(IAsyncResult ar)
        {
            GeneratorDelegate del = (GeneratorDelegate)ar.AsyncState;

            del.EndInvoke(ar);

            lock (this)
            {
                _generatorStatus = GeneratorStatus.Stopped;

                // atnaujina UI būseną
                FireStatusChangedEvent(_generatorStatus);
            }
        }
コード例 #4
0
        public void StartGenerate()
        {
            lock (this)
            {
                if (_generatorStatus == GeneratorStatus.Stopped)
                {
                    GeneratorDelegate del = new GeneratorDelegate(GenerateMessage);
                    del.BeginInvoke(new AsyncCallback(EndGenerate), del);

                    _generatorStatus = GeneratorStatus.Started;

                    // Atnaujina UI būseną
                    FireStatusChangedEvent(_generatorStatus);
                }
            }
        }
コード例 #5
0
 private void FireStatusChangedEvent(GeneratorStatus status)
 {
     if (StatusChanged != null)
     {
         GeneratorEventArgs args = new GeneratorEventArgs(status);
         if (StatusChanged.Target is Control)
         {
             Control targetForm = StatusChanged.Target as Control;
             targetForm.Invoke(StatusChanged, new object[] { this, args });
         }
         else
         {
             StatusChanged(this, args);
         }
     }
 }
コード例 #6
0
        public PpGenerator.StatusMelding StartGenereren(IEnumerable <ISlideOpbouw> ingeladenLiturgie, string opslaanAlsBestandsnaam)
        {
            Status = GeneratorStatus.AanHetGenereren;
            var lezenText = string.Join("\n", Registration.Lezen);
            var tekstText = string.Join("\n", Registration.Tekst);
            var status    = _powerpoint.Initialiseer(ingeladenLiturgie.ToList(), Registration.Voorganger, Registration.Collecte1e, Registration.Collecte2e, lezenText, tekstText, _instellingenFactory.LoadFromFile(), opslaanAlsBestandsnaam);

            if (status.Fout == null)
            {
                status = _powerpoint.Start();
            }
            // Stop weer als er een fout is geweest
            if (status.NieuweStatus != PpGenerator.State.Gestart)
            {
                PresentatieGereedmeldingCallback();
            }
            return(status);
        }
コード例 #7
0
ファイル: ItemContainerGenerator.cs プロジェクト: mind0n/hive
        //[CodeAnalysis("AptcaMethodsShouldOnlyCallAptcaMethods")] //Tracking Bug: 29647
        private void SetStatus(GeneratorStatus value)
        {
            if (value != _status)
            {
                _status = value;

                switch (_status)
                {
                    case GeneratorStatus.GeneratingContainers:
                        if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info))
                        {
                            EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringBegin, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info, "ItemsControl.Generator");
                            _itemsGenerated = 0;
                        }
                        else
                            _itemsGenerated = Int32.MinValue;
#if GENERATOR_TRACE
                        _creationTimer.Reset();
                        _timer.Begin();
#endif
                        break;

                    case GeneratorStatus.ContainersGenerated:
                        string label = null;
                        if (_itemsGenerated >= 0)   // this implies that tracing is enabled
                        {
                            DependencyObject d = Host as DependencyObject;
                            if (d != null)
                                label = (string)d.GetValue(FrameworkElement.NameProperty);
                            if (label == null || label.Length == 0)
                                label = Host.GetHashCode().ToString(CultureInfo.InvariantCulture);
                            EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringEnd, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info,
                                                                 String.Format(CultureInfo.InvariantCulture, "ItemContainerGenerator for {0} {1} - {2} items", Host.GetType().Name, label, _itemsGenerated));
                        }
#if GENERATOR_TRACE
                        _timer.End();
                        if (_itemsGenerated > 0)
                        {
                            Console.WriteLine("Generator for {0} {1}  did {2} items in {3:f2} msec - {4:f2} msec/item",
                                Host.GetType().Name, label, _itemsGenerated, _timer.TimeOfLastPeriod, _timer.TimeOfLastPeriod/_itemsGenerated);
                            Console.WriteLine("  this excludes time for element creation: {0:f2} msec - {1:f2} msec/item",
                                _creationTimer.OverallTimeInMilliseconds, _creationTimer.OverallTimeInMilliseconds/_itemsGenerated);
                        }
#endif
                        break;
                }

                if (StatusChanged != null)
                    StatusChanged(this, EventArgs.Empty);
            }
        }
コード例 #8
0
 public GeneratorEventArgs(GeneratorStatus status)
 {
     this.Status = status;
 }