コード例 #1
0
ファイル: StartUp.cs プロジェクト: rluiten/desktopPet
        /// <summary>
        /// Constructor. Called when application is started.
        /// </summary>
        /// <param name="processIcon">ProcessIcon class, to change icon when a new pet is selected.</param>
        public StartUp(ProcessIcon processIcon)
        {
            pi = processIcon;

            // Init XML class
            xml = new Xml();
            // Init Animations class
            animations = new Animations(xml);

            // If SHIFT key was pressed, open Debug window
            Keys ks = Control.ModifierKeys;

            if (ks == Keys.Shift)
            {
                debug = new FormDebug();
                debug.Show();
                AddDebugInfo(DEBUG_TYPE.info, "debug window started");
            }

            // Read XML file and start new sheep in 1 second
            if (!xml.readXML())
            {
                Properties.Settings.Default.xml = Properties.Resources.animations;
                Properties.Settings.Default.Save();
                xml.readXML();
            }

            // Set animation icon
            pi.SetIcon(xml.bitmapIcon,
                       xml.AnimationXML.Header.Petname,
                       xml.AnimationXML.Header.Author,
                       xml.AnimationXML.Header.Title,
                       xml.AnimationXML.Header.Version,
                       xml.AnimationXML.Header.Info
                       );

            // Wait 1 second, before starting first animation
            timer1.Tag      = "A";
            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Interval = 1000;
            timer1.Enabled  = true;

            if (Program.ArgumentInstall == "yes")
            {
                Install install = new Install();
                install.ShowInstallation();
            }
        }
コード例 #2
0
ファイル: StartUp.cs プロジェクト: yangliGit/desktopPet
        /// <summary>
        /// Constructor. Called when application is started.
        /// </summary>
        /// <param name="processIcon">ProcessIcon class, to change icon when a new pet is selected.</param>
        public StartUp(ProcessIcon processIcon)
        {
            pi = processIcon;

            // Init XML class
            xml = new Xml();
            // Init Animations class
            animations = new Animations(xml);

            // If SHIFT key was pressed, open Debug window
            Keys ks = Control.ModifierKeys;

            if (ks == Keys.Shift)
            {
                debug = new FormDebug();
                debug.Show();
                AddDebugInfo(DEBUG_TYPE.info, "debug window started");
            }

            // Read XML file and start new sheep in 1 second
            if (!xml.readXML())
            {
                Program.MyData.SetXml(Properties.Resources.animations, "esheep64");
                xml.readXML();
            }

            // Set animation icon
            pi.SetIcon(xml.bitmapIcon,
                       xml.AnimationXML.Header.Petname,
                       xml.AnimationXML.Header.Author,
                       xml.AnimationXML.Header.Title,
                       xml.AnimationXML.Header.Version,
                       xml.AnimationXML.Header.Info
                       );

            // Wait 1 second, before starting first animation
            timer1.Tag      = "A";
            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Interval = 1000;
            timer1.Enabled  = true;

            Program.MyData.ListenOnXMLChanged(XmlFileChanged);
            Program.MyData.ListenOnOptionsChanged(OptionFileChanged);
        }