private void ExecuteDeleteSubscribeSettingCommand(object deleteItem)
        {
            var subscribeModel = deleteItem as SubscribeModel;

            if (subscribeModel == null)
            {
                return;
            }
            //检查接收标志位(若为true则不允许删除配置)
            if (SynchronousSocketManager.Instance.ReceivingFlag)
            {
                MessageBox.Show("当前正在接收,不允许删除任何接收配置项!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //删除接收配置
            SubscribeCollection.Remove(subscribeModel);
            ConfigHelper.Instance.SaveSettings();
            //删除接收配置后,综合接收配置决定是否通知监控端删除订阅信息
            Task.Factory.StartNew(() =>
            {
                if (SubscribeCollection.FirstOrDefault(s => s.MonitorIP == subscribeModel.MonitorIP && s.MonitorAlias == subscribeModel.MonitorAlias) == null)
                {
                    SynchronousSocketManager.Instance.SendUnregisterSubscribeInfo(UtilHelper.Instance.GetIPEndPoint(string.Format("{0}:{1}", subscribeModel.MonitorIP, subscribeModel.MonitorListenPort)), subscribeModel.MonitorAlias);
                }
            });
        }
        //private void ShowCompleteAcceptFile(string monitorIp, string monitorDirectory)
        //{
        //    SubscribeCollection.Where(s => s.MonitorIP == monitorIp && s.MonitorAlias == monitorDirectory).ToList().ForEach(s =>
        //    {
        //        s.AcceptFileName = @"";
        //        s.AcceptFilePercent = 0.0;
        //    });
        //}

        //private void ShowCompleteSendFile(string monitor)
        //{
        //    var monitorModel = MonitorCollection.FirstOrDefault(m => m.MonitorDirectory == monitor);
        //    if (monitorModel == null) return;
        //    monitorModel.SubscribeInfos.ToList().ForEach(s =>
        //    {
        //        s.TransferFileName = @"";
        //        s.TransferPercent = 0.0;
        //    });
        //}

        public void ShowAcceptProgress(string monitorIp, string monitorAlias, string acceptDirectory, string receiveFile, double progress)
        {
            var subscribeModel = SubscribeCollection.FirstOrDefault(s => s.MonitorIP == monitorIp && s.MonitorAlias == monitorAlias && s.AcceptDirectory == acceptDirectory);

            if (subscribeModel == null)
            {
                return;
            }
            subscribeModel.AcceptFileName    = receiveFile;
            subscribeModel.AcceptFilePercent = progress;
        }
        private void ExecuteDeleteMonitorCommand(object deleteItem)
        {
            var model1 = deleteItem as MonitorModel;

            if (model1 != null)
            {
                //检查发送标志位(若为true则不允许删除配置)
                if (SynchronousSocketManager.Instance.SendingFilesFlag)
                {
                    MessageBox.Show("当前正在发送文件,不允许删除任何监控配置项!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                //删除监控配置
                MonitorCollection.Remove(model1);
                if (string.IsNullOrEmpty(model1.SubscribeIP))
                {
                    return;
                }
                //删除监控配置后通知相关订阅方,删除相关配置
                SynchronousSocketManager.Instance.SendDeleteMonitorInfo(UtilHelper.Instance.GetIPEndPoint(model1.SubscribeIP), model1.MonitorDirectory);
            }
            else
            {
                var model2 = deleteItem as SubscribeModel;
                if (model2 == null)
                {
                    return;
                }
                //检查接收标志位(若为true则不允许删除配置)
                if (SynchronousSocketManager.Instance.ReceivingFlag)
                {
                    MessageBox.Show("当前正在接收,不允许删除任何接收配置项!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                //删除接收配置
                SubscribeCollection.Remove(model2);
                //删除接收配置后,综合接收配置决定是否通知监控端删除订阅信息
                if (SubscribeCollection.FirstOrDefault(s => s.MonitorIP == model2.MonitorIP) == null)
                {
                    SynchronousSocketManager.Instance.SendUnregisterSubscribeInfo(UtilHelper.Instance.GetIPEndPoint(string.Format("{0}:{1}", model2.MonitorIP, model2.MonitorListenPort)), model2.MonitorDirectory);
                }
            }
        }