Пример #1
0
 void LV_IP_SelectionChanged(object sender, EventArgs e)
 {
     if (EXPD_Zkplay.IsExpanded)
     {
         LV_IP.ItemsSource = CSV.Select(x => { x.IsChecked = false; return(x); });
         if (LV_IP.SelectedItem != null)
         {
             lv_ip_item = (LV_IP_Item)LV_IP.SelectedItem;
             if (lv_ip_item.Online)
             {
                 if (!Regex.Match(lv_ip_item.PlusbeZK, "zkplay||内容").Success)
                 {
                     Console.WriteLine("未指定Zkplay路径.");
                 }
                 else
                 {
                     TB_CurrentIP.Text = lv_ip_item.IP;
                     ZKPList           = new ZkplayPlayList(this, TB_CurrentIP.Text, lv_ip_item.PlusbeZK);
                     System.Threading.Thread thread = new System.Threading.Thread(delegate()
                     {
                         ZKPList.GetConfig();
                         if (ZKPList.config != null)
                         {
                             Dispatcher.Invoke(() =>
                             {
                                 LV_ZkplayPlayList.ItemsSource = ZKPList.config.list;
                             });
                         }
                     });
                     thread.Start();
                 }
             }
         }
     }
 }
Пример #2
0
        void MI_Trigger(object sender, EventArgs e)
        {
            if (TB_CurrentIP.Text != "TextBox")
            {
                System.Windows.Controls.MenuItem mi = sender as System.Windows.Controls.MenuItem;
                lv_ip_item = (LV_IP_Item)LV_IP.SelectedItem;
                //ZKPList = new ZkplayPlayList(this, lv_ip_item.IP, lv_ip_item.PlusbeZK);
                //ZKPList.GetConfig();
                switch (mi.Header.ToString())
                {
                case "播放":
                    Zkplay_Play(sender, e);
                    break;

                case "上传":
                    lib.OpenFileDialog _OpenFileDialog = new lib.OpenFileDialog("LV_ZkplayPlayList");
                    string[]           filenames       = (string[])_OpenFileDialog.Browser();
                    ZKPList.Add(filenames);
                    foreach (LV_IP_Item item in CSV)
                    {
                        item.IsChecked = false;
                    }
                    CSV.Single(x => x.IP == lv_ip_item.IP).IsChecked = true;
                    TB_Batch_Destination.Text = lv_ip_item.PlusbeZK + @"\UploadFiles\";
                    PsExec_Exec("PsExec_CopyOnly");
                    break;

                case "删除":
                    ZKPList.Del(LV_ZkplayPlayList.SelectedIndex);
                    break;
                }
            }
        }
Пример #3
0
        public List <LV_IP_Item> Read(string file)
        {
            List <LV_IP_Item> ret = new List <LV_IP_Item>();

            string[] lines = File.ReadAllLines(file, System.Text.Encoding.Default);
            foreach (string line in lines)
            {
                if (line.Trim() != "" && !line.Contains("IP"))
                {
                    string[]   parts = Regex.Split(line, @",|\t");
                    LV_IP_Item item  = new LV_IP_Item();
                    item.Area   = parts[0];
                    item.Title  = parts[1];
                    item.IP     = parts[2];
                    item.Online = false;
                    item.Mac    = parts[3];
                    item.User   = parts[4];
                    if (parts[5] != "")
                    {
                        item.Passwd = parts[5];
                    }
                    else
                    {
                        item.Passwd = "\"\"";
                    }
                    item.PlusbeZK = parts[6];
                    item.Drive    = parts[6].Split(':')[0];
                    item.Other    = parts[7];
                    ret.Add(item);
                    Copy.Credential(item.IP, item.User, item.Passwd);
                }
            }
            return(ret);
        }
Пример #4
0
        private void LB_BAT_SelectionChanged(object sender, EventArgs e)
        {
            System.Windows.Controls.ListBox lb = sender as System.Windows.Controls.ListBox;
            if (lb.SelectedItem != null)
            {
                string item = (string)lb.SelectedItem;
                TB_Batch_Descriptions.Text = "";
                if (LV_IP.SelectedItem != null)
                {
                    lv_ip_item = (LV_IP_Item)LV_IP.SelectedItem;
                }
                else
                {
                    LV_IP.SelectedIndex = 0;
                    lv_ip_item          = (LV_IP_Item)LV_IP.SelectedItem;
                }
                string path = "";
                if (lb.Name == "LB_BAT_INNER")
                {
                    path = fileutils.BatInnerPath;
                }
                else if (lb.Name == "LB_BAT_CUSTOM")
                {
                    path = fileutils.BatCustomPath;
                }
                LV_Upload_Load lv_upload_load = new LV_Upload_Load(this, fileutils, batchs);
                lv_upload_load.Load(path + @"\" + item);
                TB_Batch_Destination.Text = lv_ip_item.Drive + @":\" + item + @"\";
                TB_Batch_IP.Text          = lv_ip_item.IP;
                SelectBAT = item;
                TB_Status_Change();
                switch (item)
                {
                case "PlusbeZkSet":
                    BTN_Name_PlusbeZkSet.Visibility = Visibility.Visible;
                    break;

                case "VNC":
                    TB_Batch_Other.Text = "baidu.com";
                    break;

                case "内容上传":
                    TB_Batch_Destination.Text = lv_ip_item.PlusbeZK;
                    break;

                case "Zkplay设置":
                    BTN_Name_ZkplaySetting.Visibility = Visibility.Visible;
                    TB_Batch_Destination.Text         = lv_ip_item.PlusbeZK;
                    break;

                default:
                    BTN_Name_PlusbeZkSet.Visibility   = Visibility.Hidden;
                    BTN_Name_ZkplaySetting.Visibility = Visibility.Hidden;
                    TB_Batch_Other.Text = lv_ip_item.Other;
                    break;
                }
            }
        }
Пример #5
0
 public void Window_DragDrop(object sender, System.Windows.DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
     ZKPList.Add(files);
     lv_ip_item = (LV_IP_Item)LV_IP.SelectedItem;
     foreach (LV_IP_Item item in CSV)
     {
         item.IsChecked = false;
     }
     CSV.Single(x => x.IP == lv_ip_item.IP).IsChecked = true;
     TB_Batch_Destination.Text = lv_ip_item.PlusbeZK + @"\UploadFiles\";
     PsExec_Exec("PsExec_CopyOnly");
 }
Пример #6
0
 void Copy(LV_IP_Item target)
 {
     foreach (LV_UPLOAD_Item file in Form.LV_UPLOAD.Items)
     {
         if (file.IsChecked)
         {
             string destination = "";
             Form.Dispatcher.Invoke(() =>
             {
                 destination = "\"" + Form.TB_Batch_Destination.Text + "\"";
             });
             PsExec_Gui.lib.Copy.Exec(file.Path, target.IP, destination);
         }
     }
 }
Пример #7
0
        /// 由ChecBox的Click事件来记录被选中行的
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LV_IP_CheckBox_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.CheckBox cb = sender as System.Windows.Controls.CheckBox;
            string     tag  = cb.Tag.ToString();
            LV_IP_Item Item = CSV.Find(x => x.IP == tag);

            if (cb.IsChecked == true)
            {
                Item.IsChecked = true;
            }
            else
            {
                Item.IsChecked = false;
            }
            TB_Status_Change();
        }
Пример #8
0
 public void Exec(LV_IP_Item target, string command)
 {
     ThreadArg.target  = target;
     ThreadArg.command = command;
     m_BackgroundWorker.RunWorkerAsync(ThreadArg);
 }