示例#1
0
        /// <summary>
        /// 获取场景对象的缩略图缓存
        /// </summary>
        /// <param name="scene">场景对象</param>
        /// <returns>缩略图缓存文件列表</returns>
        public static IEnumerable <string> GetCacheThumb(Scene scene)
        {
            // 获取缓存目录
            string cacheDir = GetCacheDirectory(scene);

            if (!Directory.Exists(cacheDir))
            {
                Directory.CreateDirectory(cacheDir);
            }

            // 检查是否有缓存照片
            IEnumerable <string> thumbFiles = Directory.GetFiles(cacheDir, ThumbWildcard, SearchOption.TopDirectoryOnly);

            if (thumbFiles.Any()) // 有缓存
            {
                // 检测是否需要更新缓存
                if (NeedUpdateCache(scene, cacheDir) && DialogResult.OK == MessageBoxEx.Confirm(@"检测到照片有更新,是否立即执行更新?")) // 需要
                {
                    UpdateCache(scene, cacheDir);
                    return(Directory.GetFiles(cacheDir, ThumbWildcard, SearchOption.TopDirectoryOnly));
                }
                return(thumbFiles);
            }
            // 下载全部
            return(DownloadToCache(scene, cacheDir));
        }
示例#2
0
 private void btnDeleteObject_Click(object sender, EventArgs e)
 {
     // 删除确认
     if (DialogResult.OK != MessageBoxEx.Confirm(@"确定要删除该场景吗?"))
     {
         return;
     }
     // 开始删除
     ProcDelete();
 }
示例#3
0
 private void photoManager_DeletePhotoButtonClick(object sender, EventArgs e)
 {
     // 删除确认
     if (DialogResult.OK != MessageBoxEx.Confirm(@"确定要删除选中的照片吗?"))
     {
         return;
     }
     // 开始删除
     StartBackWork(ProcDeletePhoto);
 }
示例#4
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!_mustClose)
            {
                if (!MessageBoxEx.Confirm("确认关闭投注后台服务吗(建议最后退出)?"))
                {
                    e.Cancel = true;
                    return;
                }
            }

            Uninstall();
        }
示例#5
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            if (!_mustClose)
            {
                if (!MessageBoxEx.Confirm("确认关闭客户端程序吗?", this))
                {
                    e.Cancel = true;
                    return;
                }
            }

            Uninstall();
        }
示例#6
0
        private void btnDirectSell_Click(object sender, EventArgs e)
        {
            if (MessageBoxEx.Confirm("确认要直接出货吗?", this))
            {
                for (int i = 0; i < 5; i++)
                {
                    BetNoOddsDataBind(null);
                }

                //出货
            }

            dgvOddsList.DataSource = oddsList;
        }
示例#7
0
文件: FrmTheme.cs 项目: zanderphh/TMS
        private void btnDeleteObject_Click(object sender, EventArgs e)
        {
            // 删除确认
            if (DialogResult.OK != MessageBoxEx.Confirm(@"请注意!
删除风格后,从属于该风格的所有场景也将会被删除!
建议使用“停用”功能。
确定要删除该风格吗?"))
            {
                return;
            }

            // 开始删除
            ProcDelete();
        }
示例#8
0
        private void photoManager_AddPhotoButtonClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(ServerPath))
            {
                MessageBoxEx.Error(@"请先选择一个上传路径!");
                cmbServerPath.Focus();
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog
            {
                Multiselect = true,
                Filter      = DressManager.OriginalPhotoFileFilter
            };

            if (DialogResult.OK == dlg.ShowDialog())
            {
                // 检测重名的文件
                List <string> duplicatedFilesName = new List <string>();
                List <string> files = new List <string>();
                foreach (string fileName in dlg.FileNames)
                {
                    string name = fileName;
                    if (photoManager.Photos.Paths.Exists(fn => Path.GetFileNameWithoutExtension(fn) == Path.GetFileNameWithoutExtension(name)))
                    {
                        duplicatedFilesName.Add(Path.GetFileName(name));
                    }
                    else
                    {
                        files.Add(name);
                    }
                }

                // 提示存在重名文件
                if (duplicatedFilesName.Count > 0
                    &&
                    DialogResult.OK != MessageBoxEx.Confirm(string.Format(@"以下照片的文件名与现有照片的文件名重复:
{0}
这些文件将不会被添加,是否继续?", string.Join(Environment.NewLine, duplicatedFilesName.ToArray()))))
                {
                    return;
                }

                // 开始添加
                StartBackWork(ProcAddPhoto, files);
            }
        }
示例#9
0
 private void ProcDelete()
 {
     if (DialogResult.OK != MessageBoxEx.Confirm(string.Format(@"确定要移除对象'{0}'吗?", SelectedDressBarCode)))
     {
         return;
     }
     try
     {
         string dressBarCode = SelectedDressBarCode;
         DressManager.DeleteThemeDress(CurrentTheme, dressBarCode, CurrentTypeID);
         DressBarCodes = DressBarCodes.Where(s => s != dressBarCode).ToList();
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(string.Format(@"移除失败,原因为{0}{1}", Environment.NewLine, ex.Message));
     }
 }
示例#10
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!MessageBoxEx.Confirm("确认关闭中心服务器吗(如果关闭,将提示用户关闭投注程序)?"))
            {
                e.Cancel = true;
                return;
            }

            // 广播中心服务器关闭命令
            Log(Environment.NewLine + "关闭中心服务器,等待其它端自动关闭!");
            MQPublishQueue.CloseCenterServer();

            // 等待各个服务端都退出
            int tryCount = 20;

            while (tryCount > 0)
            {
                if (SessionPool.HasUnConnectedServers())
                {
                    Thread.Sleep(500);
                }
                else
                {
                    break;
                }
                tryCount--;
            }

            // 检查是否有未退出的服务端(除开客户使用的端)
            if (SessionPool.HasUnConnectedServers())
            {
                MessageBoxEx.Confirm("还存在未关闭的其它控制端软件,请手工退出所有后台采集程序?");
            }

            _cancellationTokenSource.Cancel();
            Thread.Sleep(500);
        }