Exemple #1
0
        private void btn_AddBookMark_Click(object sender, RoutedEventArgs e)
        {
            AddBookMark addBookMark = new AddBookMark();

            addBookMark.ShowDialog();

            if (addBookMark.textBox_Url.Text != "")
            {
                BookMarkBean bookMarkBeanTemp = new BookMarkBean();
                bookMarkBeanTemp.ShuoMing = addBookMark.textBox_ShuoMing.Text;
                bookMarkBeanTemp.Url      = addBookMark.textBox_Url.Text;
                bookMarkBeanTemp.User     = addBookMark.textBox_User.Text;
                bookMarkBeanTemp.Psw      = addBookMark.textBox_Psw.Text;

                if (bookMarkList.Count > 0)
                {
                    int no = 0;
                    try {
                        no = int.Parse(bookMarkList[bookMarkList.Count - 1].No);
                    }
                    catch (Exception)
                    {
                        bookMarkList.Clear();
                    }
                    bookMarkBeanTemp.No = no + 1 + "";
                }
                else
                {
                    bookMarkBeanTemp.No = "1";
                }

                bookMarkList.Add(bookMarkBeanTemp);
                changeFlg = true;
            }
        }
Exemple #2
0
        //书签行删除按钮
        private void btn_LineDel_Click(object sender, RoutedEventArgs e)
        {
            string lineNum = (sender as Button).Tag.ToString();

            BookMarkBean bookMarkBeanTemp = getbookMarkBeanByNo(lineNum);

            if (bookMarkBeanTemp != null)
            {
                bookMarkList.Remove(bookMarkBeanTemp);
            }
        }
Exemple #3
0
        private BookMarkBean getbookMarkBeanByNo(string no)
        {
            BookMarkBean bookMarkBeanReturn = null;

            foreach (BookMarkBean bookMarkBeanTemp in bookMarkList)
            {
                if (no == bookMarkBeanTemp.No)
                {
                    bookMarkBeanReturn = bookMarkBeanTemp;
                    break;
                }
            }
            return(bookMarkBeanReturn);
        }
Exemple #4
0
        //鼠标拖动,变更顺序用
        private void listView_View_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (changeOrderFlg && //拖动中
                this.listView_View.SelectedIndex != -1 && //且有被选中
                changeOrderStartNum != -1 && //且起始被选择块有
                changeOrderStartNum != this.listView_View.SelectedIndex)   //且起始被选择块 和 当前选择块不一致
            {
                changeOrderEndNum = this.listView_View.SelectedIndex;

                //交换
                BookMarkBean bookMarkBeanTemp = bookMarkList[changeOrderStartNum];
                bookMarkList[changeOrderStartNum] = bookMarkList[changeOrderEndNum];
                bookMarkList[changeOrderEndNum]   = bookMarkBeanTemp;

                changeOrderStartNum = changeOrderEndNum;

                listView_View.SelectedIndex = changeOrderEndNum;

                changeFlg = true;
            }
        }
Exemple #5
0
        private void InitData()
        {
            //int status = 0;//0:密码  1:类别  2:书签详细
            int lineNum = 1;                                                                                  //按顺序排列,通过求余知道是什么内容

            string classNameNow = "";                                                                         //当前循环的书签类名
            string classNameNew = "";                                                                         //新循环的书签类名
            ObservableCollection <BookMarkBean> bookMarkListTemp = new ObservableCollection <BookMarkBean>(); //当前循环的书签List
            BookMarkBean bookMarkTemp = new BookMarkBean();                                                   //当前循环的书签

            StreamReader sr      = (new System.IO.StreamReader(@"const.ini"));
            String       lineStr = sr.ReadLine();

            while (lineStr != null)
            {
                if (lineNum == 1)
                {   //第一行密码
                    password = Des.DESDecrypt(lineStr);
                }
                else
                {
                    switch ((lineNum - 1) % 6)
                    {
                    case 1:
                        classNameNew = Des.DESDecrypt(lineStr);

                        if (classNameNew != classNameNow && lineNum != 2)
                        {
                            //新书签List时,把上一个保存到字典中
                            dic.Add(classNameNow, bookMarkListTemp);
                            bookMarkListTemp = new ObservableCollection <BookMarkBean>();
                            classList.Add(classNameNow);
                        }
                        classNameNow = classNameNew;

                        bookMarkTemp = new BookMarkBean();
                        //bookMarkTemp.ClassName = lineStr;

                        break;

                    case 2:
                        bookMarkTemp.No = lineStr;
                        break;

                    case 3:
                        bookMarkTemp.ShuoMing = Des.DESDecrypt(lineStr);
                        break;

                    case 4:
                        bookMarkTemp.Url = Des.DESDecrypt(lineStr);
                        break;

                    case 5:
                        bookMarkTemp.User = Des.DESDecrypt(lineStr);
                        break;

                    case 0:
                        //书签区块的最后一行时,保存在同类书签List中
                        bookMarkTemp.Psw = Des.DESDecrypt(lineStr);
                        if (bookMarkTemp.No != "")     //No==""无效的空白书签
                        {
                            bookMarkListTemp.Add(bookMarkTemp);
                        }
                        break;
                    }
                }

                lineNum++;
                lineStr = sr.ReadLine();
                continue;
            }
            //读到最后,将没保存的最后一个保存
            dic.Add(classNameNow, bookMarkListTemp);
            classList.Add(classNameNow);
            sr.Close();

            this.comboBox.ItemsSource = classList;
            //初期选择第一个
            classSelectChange(classList.IndexOf(ConfigurationManager.AppSettings["defaultClass"]));

            //浏览器区块设置
            this.comboBox_browser.ItemsSource       = browser_list;
            this.comboBox_browser.SelectedValuePath = "Key";
            this.comboBox_browser.DisplayMemberPath = "Value";
            this.comboBox_browser.SelectedValue     = ConfigurationManager.AppSettings["defaultBrowser"];

            //3个参数设置
            this.textBox_parm1.Text = ConfigurationManager.AppSettings["defaultParm1"];
            this.textBox_parm2.Text = ConfigurationManager.AppSettings["defaultParm2"];
            this.textBox_parm3.Text = ConfigurationManager.AppSettings["defaultParm3"];


            listView_View.AddHandler(Button.MouseLeftButtonDownEvent, new MouseButtonEventHandler(listView_View_MouseLeftButtonDown), true);
        }