コード例 #1
0
        public void performOnStartup()
        {
            wordDictionary             = sentenceDictionary.wordDictionary;
            textbooks                  = new Textbooks();
            this.LeftSidebar.mainPage  = this;
            this.RightSidebar.mainPage = this;
            this.LeftSidebar.performOnStartup();
            this.RightSidebar.performOnStartup();
            MouseButtonEventHandler closePopupIfClickedOutside = (s, e) =>
            {
                if (popup == null)
                {
                    return;
                }
                Point position = e.GetPosition(popup);
                if (position.X >= 0 && position.Y >= 0)
                {
                    if (position.X <= popup.ActualWidth && position.Y <= popup.ActualHeight)
                    {
                        return;
                    }
                }
                popup = null;
            };

            this.AddHandler(UIElement.MouseLeftButtonDownEvent, closePopupIfClickedOutside, true);
            PopupShield.AddHandler(UIElement.MouseLeftButtonDownEvent, closePopupIfClickedOutside, true);
            //HtmlPage.RegisterScriptableObject("mainPage", this);
            //HtmlPage.RegisterScriptableObject("sentenceDictionary", sentenceDictionary);
            //HtmlPage.RegisterScriptableObject("wordDictionary", wordDictionary);

            App.Current.Host.Content.Resized += new EventHandler(Content_Resized);

            // remove this block to prevent auto-login as anthonyl

            /*
             * if (!Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) && serverCommunication.username == null)
             * {
             *  if (Keyboard.Modifiers.HasFlag(ModifierKeys.Alt))
             *  {
             *      serverCommunication.username = "******";
             *  }
             *  else
             *  {
             *      serverCommunication.username = "******";
             *  }
             *  userLoggedIn();
             * }
             */
            // end of auto-login block

            //getDisplayedWords();
            new Thread(() =>
            {
                while (!isLoggedIn)
                {
                    Thread.Sleep(10);
                }
                this.Dispatcher.BeginInvoke(() =>
                {
                    getDisplayedWords();
                });
            }).Start();



            Content_Resized(null, null);
        }