Esempio n. 1
0
 public ucTaskInfo()
 {
     InitializeComponent();
     label          = new DevComponents.DotNetBar.LabelItem();
     label.Text     = "name";
     label.Width    = 100;
     label.WordWrap = false;
     image          = new DevComponents.DotNetBar.ButtonItem();
     //image.Name = "itemContainer";
     image.Image          = Properties.Resources.bkpng;
     image.FixedSize      = new System.Drawing.Size(100, 58);
     image.ImageFixedSize = new System.Drawing.Size(96, 54);
     image.ColorTable     = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
     image.Shape          = new DevComponents.DotNetBar.RoundRectangleShapeDescriptor(2);
     progress             = new DevComponents.DotNetBar.ProgressBarItem();
     progress.Value       = 1000;
     progress.Text        = "已完成";
     progress.TextVisible = true;
     progress.Maximum     = 1000;
     progress.Size        = new System.Drawing.Size(100, 20);
     this.SubItems.Add(label);
     this.SubItems.Add(image);
     this.SubItems.Add(progress);
     this.FixedSize = new System.Drawing.Size(100, 100);
     this.MultiLine = true;
     //image.AutoCheckOnClick = true;
     this.image.Click       += new EventHandler(image_Click);
     this.image.DoubleClick += new EventHandler(image_DoubleClick);
 }
 private void ChangeProgressBar(DevComponents.DotNetBar.ProgressBarItem pProgressBar, int min, int max, int value)
 {
     if (min != -1)
     {
         pProgressBar.Minimum = min;
     }
     if (max != -1)
     {
         pProgressBar.Maximum = max;
     }
     pProgressBar.Value = value;
     pProgressBar.Refresh();
 }
Esempio n. 3
0
        private DevComponents.AdvTree.Node AddTaskTreeNode(TaskInfoV3_1 item)
        {
            DevComponents.AdvTree.Node n = new DevComponents.AdvTree.Node(item.TaskId.ToString());
            DevComponents.AdvTree.Cell c = new DevComponents.AdvTree.Cell();
            //c.Images.Image = global::IVX.Live.MainForm.Properties.Resources.bkjpg;
            c.Images.ImageIndex = 0;

            c.Text = item.TaskName;
            uint   totalprogress   = 0;
            uint   totalstatus     = 0;
            string totalalaysetype = "";
            uint   totaltime       = 0;

            foreach (var s in item.StatusList)
            {
                if (s.AlgthmType != E_VIDEO_ANALYZE_TYPE.E_ANALYZE_NOUSE)
                {
                    DevComponents.AdvTree.Node sn = new DevComponents.AdvTree.Node();
                    sn.Cells.Add(new DevComponents.AdvTree.Cell());
                    sn.Cells.Add(new DevComponents.AdvTree.Cell());

                    int progress = m_viewModel.CalcProgress(s.Status, (int)s.Progress, false);
                    DevComponents.DotNetBar.ProgressBarItem sprogressBarItem = new DevComponents.DotNetBar.ProgressBarItem();
                    sprogressBarItem.BackStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    sprogressBarItem.ChunkGradientAngle   = 0F;
                    sprogressBarItem.MenuVisibility       = DevComponents.DotNetBar.eMenuVisibility.VisibleAlways;
                    sprogressBarItem.RecentlyUsed         = false;
                    sprogressBarItem.Maximum     = 1000;
                    sprogressBarItem.TextVisible = true;
                    sprogressBarItem.Value       = progress;
                    if (sprogressBarItem.Value < sprogressBarItem.Maximum)
                    {
                        sprogressBarItem.Text = (item.Order > 0 || s.Status == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED) ? "" : string.Format("剩余时间:{0}", TimeSpan.FromSeconds(s.LeftTime));
                    }
                    else
                    {
                        sprogressBarItem.Text = "";
                    }
                    DevComponents.AdvTree.Cell sc2 = new DevComponents.AdvTree.Cell();
                    sc2.HostedItem = sprogressBarItem;

                    sn.Cells.Add(sc2);
                    string status = DataModel.Constant.TaskStatusInfos.Single(it => it.Status == s.Status).Name;
                    if (s.Status == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FINISH)
                    {
                        status = "<font color=\"#5555ff\" >" + status + "</font>";
                    }
                    if (s.Status == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED)
                    {
                        status = "<font color=\"#ff0000\" >" + status + "</font>";
                    }
                    sn.Cells.Add(new DevComponents.AdvTree.Cell(status));
                    sn.Cells.Add(new DevComponents.AdvTree.Cell(DataModel.Constant.VideoAnalyzeTypeInfo.Single(it => it.Type == s.AlgthmType).Name));

                    //DevComponents.DotNetBar.ButtonItem sbuttonItem = new DevComponents.DotNetBar.ButtonItem();
                    //sbuttonItem.Text = "删除";
                    //sbuttonItem.Click += buttonItem_Click;
                    //sbuttonItem.Tag = new Tuple<uint, E_VIDEO_ANALYZE_TYPE>(item.TaskId, s.AlgthmType);
                    DevComponents.AdvTree.Cell sc1 = new DevComponents.AdvTree.Cell();
                    //sc1.HostedItem = sbuttonItem;
                    sc1.Text = m_viewModel.GetActionURL(s.Status, s.AlgthmType, item.TaskType);// +"<a href=\"del\">删除算法</a>";
                    sn.Cells.Add(sc1);
                    DevComponents.DotNetBar.ButtonItem sbuttonItem2 = new DevComponents.DotNetBar.ButtonItem();
                    sbuttonItem2.Text   = "";
                    sbuttonItem2.Click += buttonItem_Click;
                    //sbuttonItem2.Image = Properties.Resources.remove_analyse_24;
                    sbuttonItem2.Symbol  = "";//"/uf056";
                    sbuttonItem2.Tooltip = "删除算法";
                    //buttonItem.Tag = new Tuple<uint, E_VIDEO_ANALYZE_TYPE>(item.TaskId, E_VIDEO_ANALYZE_TYPE.E_ANALYZE_NOUSE);
                    DevComponents.AdvTree.Cell sc3 = new DevComponents.AdvTree.Cell();
                    sc3.HostedItem = sbuttonItem2;
                    sn.Cells.Add(sc3);
                    sn.Tag = new Tuple <uint, StatusInfoV3_1>(item.TaskId, s);
                    n.Nodes.Add(sn);
                }
                totalprogress += (uint)m_viewModel.CalcProgress(s.Status, (int)s.Progress);
                if (totalstatus == 0)
                {
                    totalstatus = (uint)s.Status;
                }
                else
                {
                    if (totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_WAIT ||
                        s.Status == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_WAIT)
                    {
                        if (totalstatus + (uint)s.Status == 10)
                        {
                            totalstatus = 5;
                        }
                        else if (totalstatus + (uint)s.Status == 11)
                        {
                            totalstatus = 6;
                        }
                        else if (totalstatus + (uint)s.Status == 12)
                        {
                            totalstatus = 5;
                        }
                        else if (totalstatus + (uint)s.Status == 13)
                        {
                            totalstatus = 5;
                        }
                        else
                        if (s.Status > 0)
                        {
                            totalstatus = Math.Min(totalstatus, (uint)s.Status);
                        }
                    }
                    else if (totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED ||
                             s.Status == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED)
                    {
                        if (totalstatus + (uint)s.Status >= 15)
                        {
                            totalstatus = 8;
                        }
                        else
                        if (s.Status > 0)
                        {
                            totalstatus = Math.Min(totalstatus, (uint)s.Status);
                        }
                    }
                    else
                    if (s.Status > 0)
                    {
                        totalstatus = Math.Min(totalstatus, (uint)s.Status);
                    }
                }
                totalalaysetype += DataModel.Constant.VideoAnalyzeTypeInfo.Single(it => it.Type == s.AlgthmType).Name + " ";
                totaltime        = Math.Max(totaltime, s.LeftTime);
            }

            if (item.StatusList.Count > 0)
            {
                totalprogress /= (uint)item.StatusList.Count;
            }
            else
            {
                totalprogress = 1000;
                totalstatus   = (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FINISH;
            }
            n.Cells.Add(c);
            n.Cells.Add(new DevComponents.AdvTree.Cell(item.StartTime.ToString()));

            DevComponents.DotNetBar.ProgressBarItem progressBarItem = new DevComponents.DotNetBar.ProgressBarItem();
            progressBarItem.BackStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            progressBarItem.ChunkGradientAngle   = 0F;
            progressBarItem.MenuVisibility       = DevComponents.DotNetBar.eMenuVisibility.VisibleAlways;
            progressBarItem.RecentlyUsed         = false;
            progressBarItem.Maximum     = 1000;
            progressBarItem.TextVisible = true;
            progressBarItem.Value       = (int)totalprogress;
            if (totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED || totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_FAILED)
            {
                progressBarItem.Text = "";
            }
            else
            {
                if (progressBarItem.Value < progressBarItem.Maximum)
                {
                    progressBarItem.Text = (item.Order > 0) ? string.Format("等待排序号:{0}", item.Order) : string.Format("剩余时间:{0}", TimeSpan.FromSeconds(totaltime));
                }
                else
                {
                    progressBarItem.Text = "";
                }
            }
            DevComponents.AdvTree.Cell c2 = new DevComponents.AdvTree.Cell();
            c2.HostedItem = progressBarItem;

            n.Cells.Add(c2);
            string statusstr = DataModel.Constant.TaskStatusInfos.Single(it => it.NStatus == totalstatus).Name;

            if (totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FINISH)
            {
                statusstr = "<font color=\"#5555ff\" ><b>" + statusstr + "</b></font>";
            }
            if (totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED || totalstatus == (uint)E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_FAILED)
            {
                statusstr = "<font color=\"#ff0000\" ><b>" + statusstr + "</b></font>";
            }
            DevComponents.AdvTree.Cell cellstatus = new DevComponents.AdvTree.Cell(statusstr);
            cellstatus.TagString = DataModel.Constant.TaskStatusInfos.Single(it => it.NStatus == totalstatus).Name;
            n.Cells.Add(cellstatus);
            n.Cells.Add(new DevComponents.AdvTree.Cell(totalalaysetype.Trim()));
            DevComponents.AdvTree.Cell c1 = new DevComponents.AdvTree.Cell();
            string url = "<a href=\"E_TASK_ACTION_TYPE_INFO\">查看信息</a> ";

            if ((E_VDA_TASK_STATUS)totalstatus >= E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_WAIT)
            {
                url += "<a href=\"E_TASK_ACTION_TYPE_PLAYBACK\">视频回放</a> ";
            }
            //url += "<a href=\"E_TASK_ACTION_TYPE_DELETE\">删除任务</a>";
            c1.Text = url;
            n.Cells.Add(c1);

            DevComponents.DotNetBar.ButtonItem buttonItem = new DevComponents.DotNetBar.ButtonItem();
            buttonItem.Text   = "";
            buttonItem.Click += buttonItem_Click;
            //buttonItem.Image = Properties.Resources._305_Close_24x24_72;
            buttonItem.Symbol  = "";// "/uf014";
            buttonItem.Tooltip = "删除任务";
            //buttonItem.Tag = new Tuple<uint, E_VIDEO_ANALYZE_TYPE>(item.TaskId, E_VIDEO_ANALYZE_TYPE.E_ANALYZE_NOUSE);
            DevComponents.AdvTree.Cell c3 = new DevComponents.AdvTree.Cell();
            c3.HostedItem = buttonItem;
            n.Cells.Add(c3);
            n.Tag = item;
            return(n);
        }
Esempio n. 4
0
        //参数bIngore:出错了是否忽略,继续写下一个地物
        private bool NewFeatures(IFeatureClass ObjFeatureCls, IFeatureCursor pfeacursor, string FieldName, object FieldValue, bool bIngore, DevComponents.DotNetBar.ProgressBarItem progressBar, out Exception eError)
        {
            eError = null;
            if (ObjFeatureCls == null)
            {
                return(false);
            }
            int FieldIndex = -1;

            FieldIndex = ObjFeatureCls.Fields.FindField(FieldName);
            IFeatureBuffer pFeatureBuffer = ObjFeatureCls.CreateFeatureBuffer();
            IFeatureCursor pObjFeaCursor  = ObjFeatureCls.Insert(true);
            IFeature       pFeature       = null;

            if (pObjFeaCursor != null)
            {
                pFeature = pfeacursor.NextFeature();
            }
            else
            {
                return(false);
            }
            while (pFeature != null)
            {
                try
                {
                    //***************************************
                    //guozheng 2011-4-11 added 对空要素的保护
                    //空要素不需要
                    if (pFeature.Shape != null)  //wgf 20111109 死机
                    {
                        if (pFeature.Shape.IsEmpty)
                        {
                            pFeature = pfeacursor.NextFeature();
                            continue;
                        }
                    }
                    else
                    {
                        pFeature = pfeacursor.NextFeature();
                        continue;
                    }
                    //****************************************

                    for (int i = 0; i < pFeature.Fields.FieldCount; i++)
                    {
                        IField aField = pFeature.Fields.get_Field(i);
                        if (aField.Type != esriFieldType.esriFieldTypeGeometry && aField.Type != esriFieldType.esriFieldTypeOID && aField.Editable)
                        {
                            int ObjIndex = pFeatureBuffer.Fields.FindField(aField.Name);
                            if (ObjIndex == -1)
                            {
                                continue;
                            }

                            pFeatureBuffer.set_Value(ObjIndex, pFeature.get_Value(i));
                        }
                    }
                    if (FieldIndex > 0)
                    {
                        try
                        {
                            pFeatureBuffer.set_Value(FieldIndex, FieldValue);
                        }
                        catch (Exception err)
                        { }
                    }

                    pFeatureBuffer.Shape = pFeature.ShapeCopy;
                    pObjFeaCursor.InsertFeature(pFeatureBuffer);

                    pFeature = pfeacursor.NextFeature();
                    if (progressBar != null)
                    {
                        progressBar.Value++;
                    }
                    Application.DoEvents();
                }
                catch (Exception eX)
                {
                    //*******************************************************************
                    //guozheng added
                    if (ModData.SysLog != null)
                    {
                        ModData.SysLog.Write(eX, null, DateTime.Now);
                    }
                    else
                    {
                        ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                        ModData.SysLog.Write(eX, null, DateTime.Now);
                    }
                    //********************************************************************
                    eError = eX;
                    if (bIngore == false)
                    {
                        break;
                    }
                    else
                    {
                        pFeature = pfeacursor.NextFeature();
                    }
                    if (progressBar != null)
                    {
                        progressBar.Value++;
                    }
                    Application.DoEvents();
                    continue;
                }
            }

            pObjFeaCursor.Flush();
            Marshal.ReleaseComObject(pObjFeaCursor);
            return(true);
        }