Exemple #1
0
        //消息处理
        protected virtual IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            switch (msg)
            {
                case 0x501:
                    {
                        List<PID> PIDList = new List<PID>();
                        PIDList = XML_W_R.XMLRead(FileName);
                        PID mypid=new PID();
                        mypid.ID="test id";
                        mypid.myICO=ICO.getICOFP("FetionFx");
                        mypid.Children.Add("child1");
                        mypid.Children.Add("child2");
                        PIDList.Add(mypid);

                        //Raise Warnning Window,write the information to File named "temp.tmp"

                        File.WriteAllText("temp.tmp","test haha");
                        WinRaise();
                        XML_W_R.XMLWrite(PIDList, FileName);
                        SetBindingOfTreeView(FileName);
                        break;
                    }
                case 0x502:
                    {
                        //Handle the Deny option
                        MessageBox.Show("you chose deny");
                        break;
                    }
                case 0x503:
                    {
                        //Handle the Allow option
                        MessageBox.Show("you chose allow");
                        break;
                    }
                case 0x504:
                    {
                        //Handle the Next time option
                        MessageBox.Show("you chose next");
                        break;
                    }

            }
            return IntPtr.Zero;
        }
Exemple #2
0
 private bool FindItem(PID pid)
 {
     if (pid.ID==RuleTree_tv.SelectedValue.ToString())
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemple #3
0
        public static List<PID> XMLRead(string SourceFile)
        {
            const int MaxItemSize = 1000;

            XmlDocument doc = new XmlDocument();
            try
            {
                doc.Load(SourceFile);
            }
            catch (System.Exception)
            {
                XMLWrite(new List<PID>(), SourceFile);
            }
            List<PID> PIDList = new List<PID>(MaxItemSize);
            XmlNodeList NodeList = doc.GetElementsByTagName("PID");
            foreach (XmlNode Node in NodeList)
            {
                PID pid = new PID();
                int index = 0;
                XmlNodeList ChildNodeList = Node.ChildNodes;
                foreach (XmlNode ChildNode in ChildNodeList)
                {
                    if (index==0)
                    {
                        pid.ID = ChildNode.InnerXml;
                    }
                    else if (index==1)
                    {
                        pid.myICO = ChildNode.InnerXml;
                    }
                    else
                    {
                        pid.Children.Add(ChildNode.InnerXml);
                    }
                    index++;
                }
                PIDList.Add(pid);
            }
            return PIDList;
        }