public EditImageForm(FileAccessBase fileAccess, List <AnalyseRecord> vm, int index)
            : this()
        {
            m_FileAccess = fileAccess;
            m_Records    = vm;

            m_VM = new ViewResultImageViewModel(m_Records, index);

            this.ucEditImageCtrl.Init(m_VM);

            this.ucEditImageCtrl.ZoomRateChanged         += new EventHandler(ucEditImageCtrl_ZoomRateChanged);
            this.m_VM.PageInfo.SelectedPageNumberChanged += new EventHandler(DetailViewPageInfo_SelectedPageNumberChanged);

            //  暂时注释掉, 因为现在的机制需要换掉  SearchResultSingleViewModel
            Framework.Container.Instance.VVMDataBindings.AddBinding(this.btnNext,
                                                                    "Enabled", m_VM.PageInfo, "CanNextPage");

            Framework.Container.Instance.VVMDataBindings.AddBinding(this.btnPrevious,
                                                                    "Enabled", m_VM.PageInfo, "CanPrePage");

            //Framework.Container.Instance.VVMDataBindings.AddBinding(this.btnNext,
            // "Enabled", m_VM.DetailViewPageInfo, "CanNextPage");

            //Framework.Container.Instance.VVMDataBindings.AddBinding(this.btnPrevious,
            // "Enabled", m_VM.DetailViewPageInfo, "CanPrePage");

            Framework.Container.Instance.VVMDataBindings.AddBinding(this.lblCtrlPageNumber,
                                                                    "Text", m_VM.PageInfo, "DisplayIndex");

            Framework.Container.Instance.VVMDataBindings.AddBinding(this.lblCtrlPageCount,
                                                                    "Text", m_VM.PageInfo, "PageCount");

            ucEditImageCtrl.SplitPositionChanged += new Action <int>(ucEditImageCtrl_SplitPositionChanged);
        }
        private void OnNewSearch(SearchPara searchPara)
        {
            SearchStartTime = DateTime.Now;
            if (PreNewSearch != null)
            {
                Dictionary <string, string> settings = searchPara.GetSettings();
                PreNewSearch(settings);
            }

            if (m_ResultPageInfo != null)
            {
                m_ResultPageInfo.SelectedPageNumberChanged -= new EventHandler(ResultPageInfo_SelectedPageNumberChanged);
            }
            //m_DTAnalyseResults.Rows.Clear();

            m_searchPara = searchPara;
            // SearchSettings = searchPara.ToString();

            m_FileAccess = FileAccessFactory.GetFileAccess("ftp://");

            //if (Framework.Container.Instance.TaskManager.Revisor != null)
            //{
            //    if (Task.Status == TaskStatus.Finished)
            //    {
            //        m_Records = Framework.Container.Instance.TaskManager.Revisor.GetAllResults(Task);
            //        m_ResultPageInfo = new DataModel.PageInfo(m_Records.Count == 0? 100 : m_Records.Count, searchPara.ResultCount, 0);
            //    }
            //    else
            //    {
            //        m_Records = null;
            //        m_ResultPageInfo = new DataModel.PageInfo(100, 0, 0);
            //    }
            //}
            //else
            //{
            //    m_ResultPageInfo = new DataModel.PageInfo(100, searchPara.ResultCount, 0);
            //    m_ResultPageInfo.SelectedPageNumberChanged += new EventHandler(ResultPageInfo_SelectedPageNumberChanged);
            //    m_SQLQuery = m_searchPara.SqlQuery;
            //    //m_Records = Framework.Container.Instance.TaskManager.SwitchPage(m_SQLQuery, m_ResultPageInfo);
            //}

            //FileName = string.Format("检索耗时:{1} {0}: ", m_searchPara.ToString(), SearchCastTime);
            //RaisePropertyChangedEvent("FileName");
            //if (m_Records != null && m_Records.Count > 0)
            //{
            //    foreach (AnalyseRecord record in m_Records)
            //    {
            //        AddResultRow(m_DTAnalyseResults, record);
            //    }
            //    HasResult = true;
            //}
            //else
            //{
            //    Framework.Container.Instance.InteractionService.ShowMessageBox("没有检索到结果");
            //}

            //if (SearchResult != null)
            //{
            //    SearchResult(this, EventArgs.Empty);
            //}
        }
Exemplo n.º 3
0
        private bool ValidateInputs()
        {
            bool   bRet = false;
            string name = m_EditTask.TaskName;
            string msg;


            bRet = !Framework.Container.Instance.TaskManager.GetAllTasks().Exists(it => it.TaskName == name);
            if (!bRet)
            {
                //Framework.Container.Instance.InteractionService.ShowMessageBox(msg, "添加任务");
                ErrorMsg = "任务名称重复";
                return(bRet);
            }


            bRet = AppUtil.Common.TextUtil.ValidateNameText(ref name, false, "任务_" + DateTime.Now.ToString("yyyyMMddHHmmss"), 1, 256, out msg);
            if (!bRet)
            {
                //Framework.Container.Instance.InteractionService.ShowMessageBox(msg, "添加任务");
                ErrorMsg = msg;
                return(bRet);
            }

            m_EditTask.TaskName = name;

            if (m_EditTask.TaskType == DataModel.TaskType.Realtime)
            {
                FileAccessBase m_FileAccess = FileAccessFactory.GetFileAccess(m_EditTask.PictureSource);

                bRet = m_FileAccess.Validate(ref msg);
                if (!bRet)
                {
                    //Framework.Container.Instance.InteractionService.ShowMessageBox(msg, "添加任务");
                    ErrorMsg = msg;
                    return(bRet);
                }

                bRet = true;

                List <PictureItem> pics = null;
                try
                {
                    pics = m_FileAccess.GetFiles();
                }
                catch (Exception ex)
                {
                    Debug.Assert(false, ex.Message);
                    pics = null;
                    MyLog4Net.Container.Instance.Log.Error("获取文件列表出错", ex);
                    //Framework.Container.Instance.InteractionService.ShowMessageBox(
                    //    string.Format("获取 {0} 文件列表出错", m_EditTask.PictureSource),
                    //    Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ErrorMsg = string.Format("获取 {0} 文件列表出错", m_EditTask.PictureSource);

                    bRet = false;
                    return(bRet);
                }
                if (pics != null && pics.Count > 0)
                {
                    m_realtimepics = pics;
                }
                else
                {
                    bRet = false;
                    //Framework.Container.Instance.InteractionService.ShowMessageBox(
                    //    string.Format("目录 {0} 没有可以分析的图片", m_EditTask.PictureSource),
                    //    Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ErrorMsg = string.Format("目录 {0} 没有可以分析的图片", m_EditTask.PictureSource);
                }
            }
            return(bRet);
        }