示例#1
0
 /// <summary>
 /// Initializes a new instance of the WizardPage_ChooseDeckSourceType class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="allowFileSource">A value indicating whether this page should allow choosing the deck source from a file or not</param>
 /// <param name="allowWebpageSource">A value indicating whether this page should allow choosing the deck source from a webpage or not</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_ChooseDeckSourceType(ImportDeckWizardVM importDeckWizardVM, bool allowFileSource, bool allowWebpageSource, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage       = isStartPage;
     this.AllowFileSource    = allowFileSource;
     this.AllowWebpageSource = allowWebpageSource;
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_ChooseDeckSourceType class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="allowFileSource">A value indicating whether this page should allow choosing the deck source from a file or not</param>
 /// <param name="allowWebpageSource">A value indicating whether this page should allow choosing the deck source from a webpage or not</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_ChooseDeckSourceType(ImportDeckWizardVM importDeckWizardVM, bool allowFileSource, bool allowWebpageSource, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage = isStartPage;
     this.AllowFileSource = allowFileSource;
     this.AllowWebpageSource = allowWebpageSource;
 }
        /// <summary>
        /// Initializes a new instance of the ImportDeckWizardPageVM class.
        /// </summary>
        /// <param name="importDeckWizardVM">The parent Import Deck Wizard ViewModel</param>
        public ImportDeckWizardPageVM(ImportDeckWizardVM importDeckWizardVM)
        {
            if (importDeckWizardVM == null)
            {
                throw new ArgumentNullException();
            }

            this.ImportDeckWizardVM = importDeckWizardVM;
        }
        /// <summary>
        /// Initializes a new instance of the ImportDeckWizardPageVM class.
        /// </summary>
        /// <param name="importDeckWizardVM">The parent Import Deck Wizard ViewModel</param>
        public ImportDeckWizardPageVM(ImportDeckWizardVM importDeckWizardVM)
        {
            if (importDeckWizardVM == null)
            {
                throw new ArgumentNullException();
            }

            this.ImportDeckWizardVM = importDeckWizardVM;
        }
 /// <summary>
 /// Initializes a new instance of the WizardPage_CompareCards class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 public WizardPage_CompareCards(ImportDeckWizardVM importDeckWizardVM)
     : base(importDeckWizardVM)
 {
     if (System.Threading.Thread.CurrentThread.GetApartmentState() == System.Threading.ApartmentState.STA)
     {
         this.ShowHiddenFeatures =
            System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl) ||
            System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.RightCtrl);
     }
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the WizardPage_CompareCards class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 public WizardPage_CompareCards(ImportDeckWizardVM importDeckWizardVM)
     : base(importDeckWizardVM)
 {
     if (System.Threading.Thread.CurrentThread.GetApartmentState() == System.Threading.ApartmentState.STA)
     {
         this.ShowHiddenFeatures =
             System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl) ||
             System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.RightCtrl);
     }
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_EnterText class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_EnterText(ImportDeckWizardVM importDeckWizardVM, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage      = isStartPage;
     this.CanMoveToNextStep = false;
     foreach (string sectionName in importDeckWizardVM.Converter.ConverterGame.DeckSectionNames)
     {
         SectionText sectionText = new SectionText(sectionName);
         sectionText.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.SectionText_PropertyChanged);
         this._SectionsText.Add(sectionText);
     }
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_EnterText class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_EnterText(ImportDeckWizardVM importDeckWizardVM, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage = isStartPage;
     this.CanMoveToNextStep = false;
     foreach (string sectionName in importDeckWizardVM.Converter.ConverterGame.DeckSectionNames)
     {
         SectionText sectionText = new SectionText(sectionName);
         sectionText.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.SectionText_PropertyChanged);
         this._SectionsText.Add(sectionText);
     }
 }
        /// <summary>
        /// Fired when the DataContext of MainWindow changes.  It will store a reference to the DataContext if it is
        /// of type ImportDeckWizardVM, and subscribe to it's Close event.  Previous DataContexts will be unsubscribed.
        /// </summary>
        /// <param name="sender">The sender of the Event</param>
        /// <param name="e">The DependencyPropertyChangedEventArgs property</param>
        private void MainWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (this._ImportDeckWizardVM != null)
            {
                this._ImportDeckWizardVM.Close -= new System.EventHandler(this.ImportDeckWizardVM_Close);
            }

            this._ImportDeckWizardVM = null;

            if (e.NewValue != null && e.NewValue is ImportDeckWizardVM)
            {
                this._ImportDeckWizardVM = e.NewValue as ImportDeckWizardVM;
                this._ImportDeckWizardVM.Close += new System.EventHandler(this.ImportDeckWizardVM_Close);
            }
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the WizardPage_SelectFile class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_SelectFile(ImportDeckWizardVM importDeckWizardVM, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage      = isStartPage;
     this.CanMoveToNextStep = false;
 }
        /// <summary>
        /// Converts a URL into a ConverterDeck, then returns it
        /// </summary>
        /// <param name="deckURL">The URL of the deck to get</param>
        /// <param name="game">The Game that should be chosen in the Wizard</param>
        /// <returns>a ConverterDeck containing cards parsed from the deck file</returns>
        public static OCTGNDeckConverter.Model.ConverterDeck ConvertURLUsingWizard(
            string deckURL,
            Octgn.DataNew.Entities.Game game)
        {
            ImportDeckWizardVM idwvm = new ImportDeckWizardVM();

            // If more than one Game is installed, the ChooseGame page will be active.  Select the game
            if (idwvm.CurrentWizardPageVM is WizardPage_ChooseGame)
            {
                (idwvm.CurrentWizardPageVM as WizardPage_ChooseGame).ChooseGameCommand.Execute(game);
            }

            Assert.IsTrue(idwvm.CurrentWizardPageVM is WizardPage_ChooseDeckSourceType);
            (idwvm.CurrentWizardPageVM as WizardPage_ChooseDeckSourceType).ChooseDeckSourceTypeCommand.Execute(DeckSourceTypes.Webpage);

            Assert.IsTrue(idwvm.CurrentWizardPageVM is WizardPage_EnterWebpage);
            idwvm.Converter.DeckURL = deckURL;
            idwvm.MoveToNextStep();

            // It might take some time for the conversion, (or for the database to load) so wait for it
            DateTime waitForConversionUntil = DateTime.Now.Add(TimeSpan.FromSeconds(300));
            while (!(idwvm.CurrentWizardPageVM is WizardPage_CompareCards) && DateTime.Now < waitForConversionUntil)
            {
                System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(100));
            }

            Assert.IsTrue(idwvm.CurrentWizardPageVM is WizardPage_CompareCards);

            return idwvm.Converter.ConverterDeck;
        }
 /// <summary>
 /// Initializes a new instance of the WizardPage_CompareCards class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 public WizardPage_CompareCards(ImportDeckWizardVM importDeckWizardVM)
     : base(importDeckWizardVM)
 { 
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_ChooseGame class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 public WizardPage_ChooseGame(ImportDeckWizardVM importDeckWizardVM)
     : base(importDeckWizardVM)
 { 
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_EnterWebpage class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 /// <param name="isStartPage">A value indicating whether this page is the first page shown to the user or not</param>
 public WizardPage_EnterWebpage(ImportDeckWizardVM importDeckWizardVM, bool isStartPage)
     : base(importDeckWizardVM)
 {
     this._IsStartPage = isStartPage;
     this.CanMoveToNextStep = false;
 }
 /// <summary>
 /// Initializes a new instance of the WizardPage_ChooseGame class.
 /// </summary>
 /// <param name="importDeckWizardVM">The parent Wizard that will use this Page</param>
 public WizardPage_ChooseGame(ImportDeckWizardVM importDeckWizardVM)
     : base(importDeckWizardVM)
 {
 }