示例#1
0
        public void InitiateReferenceRead(ProjectLayoutReference[] arrayProjectLayoutReferences, bool bExporting)
        {
            if (m_zReporterProxy != null)
            {
                ReadData(arrayProjectLayoutReferences);
            }
            else
            {
                var zProgressReporter = CardMakerInstance.ProgressReporterFactory.CreateReporter(
                    "Loading Reference Data",
                    new string[] { ProgressName.REFERENCE_DATA },
                    ReadData,
                    arrayProjectLayoutReferences
                    );
                zProgressReporter.CancelButtonVisible = false;
                m_zReporterProxy = new ProgressReporterProxy()
                {
                    ProgressIndex     = 0, // known from above
                    ProgressReporter  = zProgressReporter,
                    ProxyOwnsReporter = true
                };
                CardMakerInstance.ApplicationForm.InvokeAction(() => zProgressReporter.StartProcessing(CardMakerInstance.ApplicationForm));
            }

            if (!bExporting)
            {
                // if a ref reader had an issue handle it (google for example due to auth)
                m_zErrorReferenceReader?.HandleInvalid();
            }
        }
示例#2
0
 private void InitiateReferenceRead(ProgressReporterProxy zReporterProxy, ProjectLayoutReference[] arrayProjectLayoutReferences)
 {
     if (zReporterProxy != null)
     {
         m_zReporterProxy = zReporterProxy;
         ReadData(arrayProjectLayoutReferences);
     }
     else
     {
         var zProgressReporter = CardMakerInstance.ProgressReporterFactory.CreateReporter(
             "Loading Reference Data",
             new string[] { ProgressName.REFERENCE_DATA },
             ReadData,
             arrayProjectLayoutReferences
             );
         zProgressReporter.CancelButtonVisible = false;
         m_zReporterProxy = new ProgressReporterProxy()
         {
             ProgressIndex     = 0, // known from above
             ProgressReporter  = zProgressReporter,
             ProxyOwnsReporter = true
         };
         CardMakerInstance.ApplicationForm.InvokeAction(() => zProgressReporter.StartProcessing(CardMakerInstance.ApplicationForm));
     }
 }
示例#3
0
        public void SetAndLoadLayout(ProjectLayout zLayout, bool bExporting, ProgressReporterProxy zReporterProxy)
        {
            EmptyReference = false;

            CardLayout = zLayout;

            ResetPrintCardIndex();
            ProjectLayoutReference[] zReferenceData = null;

            if (null != CardLayout.Reference)
            {
                if (CardLayout.combineReferences)
                {
                    var listReferences = new List <ProjectLayoutReference>();
                    ProjectLayoutReference zDefaultReference = null;
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zDefaultReference = zReference;
                        }
                        else
                        {
                            listReferences.Add(zReference);
                        }
                    }
                    // move the default reference to the front of the set
                    if (null != zDefaultReference)
                    {
                        listReferences.Insert(0, zDefaultReference);
                    }
                    zReferenceData = listReferences.Count == 0 ? null : listReferences.ToArray();
                }
                else
                {
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zReferenceData = new ProjectLayoutReference[] { zReference };
                            break;
                        }
                    }
                }
            }
            InitiateReferenceRead(zReporterProxy, zReferenceData);

            if (!bExporting)
            {
                if (CardMakerInstance.GoogleCredentialsInvalid)
                {
                    CardMakerInstance.GoogleCredentialsInvalid = false;
                    GoogleAuthManager.Instance.FireGoogleAuthCredentialsErrorEvent(
                        () => LayoutManager.Instance.InitializeActiveLayout());
                }
            }
        }
示例#4
0
文件: Deck.cs 项目: nhmkdev/cardmaker
        public void SetAndLoadLayout(ProjectLayout zLayout, bool bExporting, ProgressReporterProxy zReporterProxy)
        {
            EmptyReference = false;

            CardLayout = zLayout;

            ResetPrintCardIndex();
            ProjectLayoutReference[] zReferenceData = null;

            if (null != CardLayout.Reference)
            {
                if (CardLayout.combineReferences)
                {
                    var listReferences = new List <ProjectLayoutReference>();
                    ProjectLayoutReference zDefaultReference = null;
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zDefaultReference = zReference;
                        }
                        else
                        {
                            listReferences.Add(zReference);
                        }
                    }
                    // move the default reference to the front of the set
                    if (null != zDefaultReference)
                    {
                        listReferences.Insert(0, zDefaultReference);
                    }
                    zReferenceData = listReferences.Count == 0 ? null : listReferences.ToArray();
                }
                else
                {
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zReferenceData = new ProjectLayoutReference[] { zReference };
                            break;
                        }
                    }
                }
            }
            new DeckReader(this, zReporterProxy).InitiateReferenceRead(zReferenceData, bExporting);
        }
示例#5
0
 public DeckReader(Deck deck, ProgressReporterProxy reporterProxy)
 {
     m_zDeck          = deck;
     m_zReporterProxy = reporterProxy;
 }
示例#6
0
 public void SetProgressReporterProxy(ProgressReporterProxy zProgressReporterProxy)
 {
     m_zReporterProxy = zProgressReporterProxy;
 }