form1.cs

来自「这是一个实现小精灵提醒的程序」· CS 代码 · 共 397 行 · 第 1/2 页

CS
397
字号
            Chatacter.Show(null);
            Chatacter.Play("GestureLeft");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("GestureRight");
            Chatacter.MoveTo(100, 900, 4000);
            //Chatacter.Play("Reading");
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            //Chatacter.Play("Announce");
            Chatacter.MoveTo(200, 200, 1000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.MoveTo(900, 500, 1000);
            Chatacter.Play("LookLeft");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(190000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(190000);//等待过程

            Chatacter.Show(null);

            Chatacter.Play("Reading");
            Chatacter.MoveTo(100, 100, 1000);
            Chatacter.Play("Sad");
            Chatacter.MoveTo(400, 400, 1000);
            Chatacter.Play("Think");
            Chatacter.MoveTo(700, 900, 1000);
            Chatacter.Play("Announce");
            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);

            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("Processing");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("Processing");
            Chatacter.MoveTo(100, 900, 4000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(90000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.MoveTo(200, 50, 1000);
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(990000);//等待过程

            Chatacter.Show(null);
            Chatacter.Play("wave");
            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.Play("Idle2_1");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("GlanceRight");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("GestureRight");
            Chatacter.MoveTo(100, 900, 4000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(170000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");

            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(110000);//等待过程
            Chatacter.Show(null);

            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.Play("Surprised");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("GestureLeft");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("GestureRight");
            Chatacter.MoveTo(100, 900, 4000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.MoveTo(900, 500, 1000);
            Chatacter.Play("LookLeft");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(130000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.MoveTo(10, 10, 1000);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程

            Chatacter.Show(null);

            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.Play("GlanceLeft");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("GlanceRight");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("GestureRight");
            Chatacter.MoveTo(100, 900, 4000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.MoveTo(600, 600, 1000);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");

            Chatacter.Show(null);
            Chatacter.Play("Hear_1");
            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.Play("Idle2_1");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("GlanceRight");
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.Play("GestureRight");
            Chatacter.MoveTo(100, 900, 4000);
            Chatacter.Play("GetAttention");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            // Chatacter.Play("Reading");
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            Chatacter.Play("Announce");
            Chatacter.Play("Reading");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();//关闭窗体
            Application.Exit();//退出程序
        }

        private void button5_Click(object sender, EventArgs e)
        {
            //设置开机启动
            if(MessageBox.Show("你确定开机就要启动这个程序吗?","提示",MessageBoxButtons .OKCancel)==DialogResult.OK)
            {
                string dir = Directory.GetCurrentDirectory();//获取文件的当前路径
                string exedir = dir + "\\泉哥提醒.exe";//获取可执行文件的全部路径
                //获取run键
                RegistryKey key1 = Registry.LocalMachine;
                RegistryKey key2 = key1.CreateSubKey("SOFTWARE");
                RegistryKey key3 = key2.CreateSubKey("Microsoft"); 
                RegistryKey key4= key3.CreateSubKey("Windows");
                RegistryKey key5 = key4.CreateSubKey("CurrentVersion");
                RegistryKey key6 = key5.CreateSubKey("Run");
                //在run键中写入一个新值
                key6.SetValue("Form1", exedir);
                button5.Enabled = false;
                button6.Enabled = true;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            //撤销开机启动
            if (MessageBox.Show("你确定要撤销开机启动吗?", "提示", MessageBoxButtons.OKCancel)==DialogResult.OK)
            {
                //获取run键
                RegistryKey key1 = Registry.LocalMachine;
                RegistryKey key2 = key1.CreateSubKey("SOFTWARE");
                RegistryKey key3 = key2.CreateSubKey("Microsoft");
                RegistryKey key4 = key3.CreateSubKey("Windows");
                RegistryKey key5 = key4.CreateSubKey("CurrentVersion");
                RegistryKey key6 = key5.CreateSubKey("Run");
                //在run键中写入一个新值
                key6.DeleteValue("Form1", false);
                button5.Enabled = true;
                button6.Enabled = false;
            }
        }

        private void axAgent1_ClickEvent(object sender, AxAgentObjects._AgentEvents_ClickEvent e)
        {
            this.Visible = true;//显示主窗体
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?