コード例 #1
0
        /// <summary>
        /// Constructs a listener for changes to the deck traversal
        /// </summary>
        /// <param name="sender">The event queue for handling updates</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="traversal">The deck traversal we care about </param>
        public DeckTraversalWebService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_DeckTraversal = traversal;

            // Create the deck object
            string deckName = "Untitled Deck";
            using (Synchronizer.Lock(this.m_DeckTraversal.SyncRoot))
            {
                using (Synchronizer.Lock(this.m_DeckTraversal.Deck))
                {
                    deckName = this.m_DeckTraversal.Deck.HumanName;
                }
            }
            SimpleWebDeck deck = new SimpleWebDeck();
            deck.Name = deckName;
            lock (WebService.Instance.GlobalModel) {
                WebService.Instance.GlobalModel.Decks.Add(deck);
            }
            WebService.Instance.UpdateModel();

            this.m_DeckWebService = new DeckWebService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);

            this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleCurrentChanged));
            this.m_DeckTraversal.Changed["Current"].Add(this.m_CurrentChangedDispatcher.Dispatcher);
        }
コード例 #2
0
        /// <summary>
        /// Constructs a listener for changes to the deck traversal
        /// </summary>
        /// <param name="sender">The event queue for handling updates</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="traversal">The deck traversal we care about </param>
        public DeckTraversalWebService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender        = sender;
            this.m_Presentation  = presentation;
            this.m_DeckTraversal = traversal;

            // Create the deck object
            string deckName = "Untitled Deck";

            using (Synchronizer.Lock(this.m_DeckTraversal.SyncRoot))
            {
                using (Synchronizer.Lock(this.m_DeckTraversal.Deck))
                {
                    deckName = this.m_DeckTraversal.Deck.HumanName;
                }
            }
            SimpleWebDeck deck = new SimpleWebDeck();

            deck.Name = deckName;
            lock (WebService.Instance.GlobalModel) {
                WebService.Instance.GlobalModel.Decks.Add(deck);
            }
            WebService.Instance.UpdateModel();

            this.m_DeckWebService = new DeckWebService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);

            this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleCurrentChanged));
            this.m_DeckTraversal.Changed["Current"].Add(this.m_CurrentChangedDispatcher.Dispatcher);
        }