Ejemplo n.º 1
0
        private void InitPropGrid()
        {
            this.pGridPerf.Items.Clear();

            this.mItemStore = new CustomProperty(Translator.Instance.T("存储目录"), MotionConfiguration.Instance.Storage, false, Translator.Instance.T("配置"), Translator.Instance.T("设置存储目录。所有的录像、截图都将存放在该目录下面"), true);
            this.mItemStore.UseFilePathEditor = true;
            this.pGridPerf.Items.Add(this.mItemStore);

            this.mItemFontName               = new CustomProperty(Translator.Instance.T("字体"), FontHelper.GetFontFaceName(MotionConfiguration.Instance.FontName), false, Translator.Instance.T("外观"), Translator.Instance.T("设置窗口字体"), true);
            this.mItemFontName.ValueMember   = "Key";
            this.mItemFontName.DisplayMember = "Value";
            this.mItemFontName.Datasource    = FontHelper.FontList;
            this.pGridPerf.Items.Add(this.mItemFontName);

            float[]   slist = new float[] { 4F, 5F, 6F, 7F, 8F, 8.5F, 9F, 9.5F, 10F, 10.5F, 11F, 12F, 13F };
            ArrayList ls    = new ArrayList();

            for (int i = 0; i < slist.Length; i++)
            {
                ls.Add(slist[i]);
            }
            this.mItemFontSize         = new CustomProperty(Translator.Instance.T("字体大小"), MotionConfiguration.Instance.FontSize, false, Translator.Instance.T("外观"), Translator.Instance.T("设置窗口字体大小"), true);
            this.mItemFontSize.Choices = new CustomChoices(ls);
            this.pGridPerf.Items.Add(this.mItemFontSize);
            this.mPlugIns.PropertyGridItemsInitialization(this.pGridPerf.Items, true);

            this.pGridPerf.Refresh();
            this.pGridPerf.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.pGridPerf_PropertyValueChanged);
        }
Ejemplo n.º 2
0
        private void InitPropGrid()
        {
            MotionArgs Args = new MotionArgs();

            this.pGridCamera.Items.Clear();

            this.mItemName = new CustomProperty(Translator.Instance.T("摄像头名称"), this.Camera.Name, false, Translator.Instance.T("摄像头设置"), Translator.Instance.T("为本摄像头分配一个名称"), true);
            this.pGridCamera.Items.Add(this.mItemName);

            string sv = "";

            if (this.Camera.PlugInVideoSource != null)
            {
                sv = this.Camera.PlugInVideoSource.LabelText;
            }
            this.mItemStream               = new CustomProperty(Translator.Instance.T("视频来源"), sv, false, Translator.Instance.T("摄像头设置"), Translator.Instance.T("设置视频来源"), true);
            this.mItemStream.ValueMember   = "Key";
            this.mItemStream.DisplayMember = "Value";
            this.mItemStream.Datasource    = this.Camera.VideoSourceCollection;
            //this.mItemStream.SelectedValue = this.Camera.Stream;
            this.pGridCamera.Items.Add(this.mItemStream);

            this.mItemCaptureFlag               = new CustomProperty(Translator.Instance.T("录像方式"), Args.GetValue(this.Camera.Capture), false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像方式"), true);
            this.mItemCaptureFlag.ValueMember   = "Key";
            this.mItemCaptureFlag.DisplayMember = "Value";
            this.mItemCaptureFlag.Datasource    = Args.CAPTUREFLAGS;
            //this.mItemCaptureFlag.SelectedValue = this.Camera.Capture;
            this.pGridCamera.Items.Add(this.mItemCaptureFlag);

            this.mItemCaptureElapse               = new CustomProperty(Translator.Instance.T("存储方式"), Args.GetValue(this.Camera.CaptureElapse), false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像存储的方式, 你可以选择将录像按照指定的时间段分割存储, 或者连续存储."), true);
            this.mItemCaptureElapse.ValueMember   = "Key";
            this.mItemCaptureElapse.DisplayMember = "Value";
            this.mItemCaptureElapse.Datasource    = Args.CAPTURE_ELAPSE;
            //this.mItemCaptureElapse.SelectedValue = this.Camera.CaptureElapse;
            this.pGridCamera.Items.Add(this.mItemCaptureElapse);

            CodecCollection cc = new CodecCollection();

            if (cc.KVs.Count > 0)
            {
                string codec = cc.GetValue(this.Camera.Codec, Translator.Instance.T("请指定录像编码格式."));
                this.mItemCodec                     = new CustomProperty(Translator.Instance.T("录像编码格式"), codec, false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像采用的编码格式"), true);
                this.mItemCodec.ValueMember         = "Key";
                this.mItemCodec.DisplayMember       = "Value";
                this.mItemCodec.Datasource          = cc.KVs;
                this.mItemCodec.IsDropdownResizable = true;
                //this.mItemCodec.SelectedValue = this.Camera.Codec;
            }
            else
            {
                this.mItemCodec            = new CustomProperty(Translator.Instance.T("录像编码格式"), Translator.Instance.T("未找到合适的录像编码格式."), false, Translator.Instance.T("录像设置"), Translator.Instance.T("未找到合适的录像编码格式, 您需要安装视频编码驱动."), true);
                this.mItemCodec.IsReadOnly = true;
            }
            this.pGridCamera.Items.Add(this.mItemCodec);
            this.Camera.PlugIns.PropertyGridItemsInitialization(this.pGridCamera.Items);

            this.SetVideoSourceItemVisible(true);
            this.pGridCamera.Refresh();
        }
Ejemplo n.º 3
0
        private void InitGridItems(List <ZForge.Controls.PropertyGridEx.CustomProperty> list)
        {
            EMailArgs Args = new EMailArgs();

            if (this.GlobalOperation == false)
            {
                mItemUseGlobal = new CustomProperty(Translator.Instance.T("是否使用Email报警全局设置"), this.UseGlobal, false, this.CategoryText, Translator.Instance.T("确定是否使用[使用偏好]中的全局设置"), true);
                list.Add(mItemUseGlobal);
            }

            mItemAction               = new CustomProperty(Translator.Instance.T("EMail报警方式"), Args.GetValue(this.Action), false, this.CategoryText, Translator.Instance.T("设置启用或者不启用EMail报警"), true);
            mItemAction.ValueMember   = "Key";
            mItemAction.DisplayMember = "Value";
            mItemAction.Datasource    = Args.ACTIONS;
            list.Add(mItemAction);

            mItemToAddress = new CustomProperty(Translator.Instance.T("接收者EMail地址"), this.ToAddress, false, this.CategoryText, Translator.Instance.T("设置报警接收者的邮箱地址"), true);
            list.Add(mItemToAddress);

            mItemSmtpAddress = new CustomProperty(Translator.Instance.T("SMTP服务器地址"), this.SMTPAddress, false, this.CategoryText, Translator.Instance.T("设置发送邮件的SMTP服务器地址"), true);
            list.Add(mItemSmtpAddress);

            mItemSmtpPort = new CustomProperty(Translator.Instance.T("SMTP服务器端口"), this.SMTPPort.ToString(), false, this.CategoryText, Translator.Instance.T("设置发送邮件的SMTP服务器端口, 通常为25; 如果是SSL连接, 通常是465; 如果您使用的是Gmail账号, 这里应该设置成25."), true);
            list.Add(mItemSmtpPort);

            mItemUsername = new CustomProperty(Translator.Instance.T("SMTP用户名"), this.Username, false, this.CategoryText, Translator.Instance.T("设置邮件发送的用户名, 如果您使用的是Gmail账号, 这里需要填入完整的Email地址."), true);
            list.Add(mItemUsername);

            mItemPassword            = new CustomProperty(Translator.Instance.T("SMTP用户密码"), this.Password, false, this.CategoryText, Translator.Instance.T("设置邮件发送的密码"), true);
            mItemPassword.IsPassword = true;
            list.Add(mItemPassword);

            mItemSSL = new CustomProperty(Translator.Instance.T("是否是SSL连接"), this.SSL, false, this.CategoryText, Translator.Instance.T("设置是否是SSL连接, 如果您使用的是Gmail账号, 请设置为True"), true);
            list.Add(mItemSSL);

            mItemTimeout = new CustomProperty(Translator.Instance.T("邮件发送超时设置"), this.Timeout.ToString(), false, this.CategoryText, Translator.Instance.T("设置邮件发送的超时, 缺省为10秒"), true);
            list.Add(mItemTimeout);

            mItemAttachImage = new CustomProperty(Translator.Instance.T("邮件包含图片"), this.mAttachImage, false, this.CategoryText, Translator.Instance.T("设置在邮件中是否包含图片"), true);
            list.Add(mItemAttachImage);

            foreach (ZForge.Controls.PropertyGridEx.CustomProperty i in list)
            {
                i.Tag = this.ID;
            }
            this.SyncUI();
        }
Ejemplo n.º 4
0
 public virtual int Add(CustomProperty value)
 {
     return(base.List.Add(value));
 }
Ejemplo n.º 5
0
            public CustomPropertyDescriptor(CustomProperty myProperty, Attribute[] attrs)
                : base(myProperty.Name, attrs)
            {
                if (myProperty == null)
                {
                    oCustomProperty = null;
                }
                else
                {

                    oCustomProperty = myProperty;
                }
            }
Ejemplo n.º 6
0
        private void InitPropGrid()
        {
            MotionArgs Args = new MotionArgs();
            this.pGridCamera.Items.Clear();

            this.mItemName = new CustomProperty(Translator.Instance.T("摄像头名称"), this.Camera.Name, false, Translator.Instance.T("摄像头设置"), Translator.Instance.T("为本摄像头分配一个名称"), true);
            this.pGridCamera.Items.Add(this.mItemName);

            string sv = "";
            if (this.Camera.PlugInVideoSource != null)
            {
                sv = this.Camera.PlugInVideoSource.LabelText;
            }
            this.mItemStream = new CustomProperty(Translator.Instance.T("视频来源"), sv, false, Translator.Instance.T("摄像头设置"), Translator.Instance.T("设置视频来源"), true);
            this.mItemStream.ValueMember = "Key";
            this.mItemStream.DisplayMember = "Value";
            this.mItemStream.Datasource = this.Camera.VideoSourceCollection;
            //this.mItemStream.SelectedValue = this.Camera.Stream;
            this.pGridCamera.Items.Add(this.mItemStream);

            this.mItemCaptureFlag = new CustomProperty(Translator.Instance.T("录像方式"), Args.GetValue(this.Camera.Capture), false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像方式"), true);
            this.mItemCaptureFlag.ValueMember = "Key";
            this.mItemCaptureFlag.DisplayMember = "Value";
            this.mItemCaptureFlag.Datasource = Args.CAPTUREFLAGS;
            //this.mItemCaptureFlag.SelectedValue = this.Camera.Capture;
            this.pGridCamera.Items.Add(this.mItemCaptureFlag);

            this.mItemCaptureElapse = new CustomProperty(Translator.Instance.T("存储方式"), Args.GetValue(this.Camera.CaptureElapse), false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像存储的方式, 你可以选择将录像按照指定的时间段分割存储, 或者连续存储."), true);
            this.mItemCaptureElapse.ValueMember = "Key";
            this.mItemCaptureElapse.DisplayMember = "Value";
            this.mItemCaptureElapse.Datasource = Args.CAPTURE_ELAPSE;
            //this.mItemCaptureElapse.SelectedValue = this.Camera.CaptureElapse;
            this.pGridCamera.Items.Add(this.mItemCaptureElapse);

            CodecCollection cc = new CodecCollection();
            if (cc.KVs.Count > 0)
            {
                string codec = cc.GetValue(this.Camera.Codec, Translator.Instance.T("请指定录像编码格式."));
                this.mItemCodec = new CustomProperty(Translator.Instance.T("录像编码格式"), codec, false, Translator.Instance.T("录像设置"), Translator.Instance.T("设置录像采用的编码格式"), true);
                this.mItemCodec.ValueMember = "Key";
                this.mItemCodec.DisplayMember = "Value";
                this.mItemCodec.Datasource = cc.KVs;
                this.mItemCodec.IsDropdownResizable = true;
                //this.mItemCodec.SelectedValue = this.Camera.Codec;
            }
            else
            {
                this.mItemCodec = new CustomProperty(Translator.Instance.T("录像编码格式"), Translator.Instance.T("未找到合适的录像编码格式."), false, Translator.Instance.T("录像设置"), Translator.Instance.T("未找到合适的录像编码格式, 您需要安装视频编码驱动."), true);
                this.mItemCodec.IsReadOnly = true;
            }
            this.pGridCamera.Items.Add(this.mItemCodec);
            this.Camera.PlugIns.PropertyGridItemsInitialization(this.pGridCamera.Items);

            this.SetVideoSourceItemVisible(true);
            this.pGridCamera.Refresh();
        }
Ejemplo n.º 7
0
 public virtual int Add(CustomProperty value)
 {
     return base.List.Add(value);
 }
Ejemplo n.º 8
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            oEditorService = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (oEditorService != null)
            {
                // Get the Back reference to the Custom Property
                CustomProperty.CustomPropertyDescriptor oDescriptor = (CustomProperty.CustomPropertyDescriptor)context.PropertyDescriptor;
                CustomProperty cp = (CustomProperty)oDescriptor.CustomProperty;

                // Declare attributes
                UIListboxDatasource    datasource;
                UIListboxValueMember   valuemember;
                UIListboxDisplayMember displaymember;

                // Get attributes
                datasource    = (UIListboxDatasource)context.PropertyDescriptor.Attributes[typeof(UIListboxDatasource)];
                valuemember   = (UIListboxValueMember)context.PropertyDescriptor.Attributes[typeof(UIListboxValueMember)];
                displaymember = (UIListboxDisplayMember)context.PropertyDescriptor.Attributes[typeof(UIListboxDisplayMember)];

                oList.BorderStyle    = BorderStyle.None;
                oList.IntegralHeight = true;

                if (datasource != null)
                {
                    oList.DataSource     = datasource.Value;
                    oList.BindingContext = new BindingContext();
                }

                if (displaymember != null)
                {
                    oList.DisplayMember = displaymember.Value;
                }

                if (valuemember != null)
                {
                    oList.ValueMember = valuemember.Value;
                }

                if (value != null)
                {
                    if (value.GetType().Name == "String")
                    {
                        oList.Text = (string)value;
                    }
                    else
                    {
                        oList.SelectedItem = value;
                    }
                }
                if (oList.SelectedValue == null)
                {
                    oList.SelectedValue = cp.SelectedValue;
                }

                oList.SelectedIndexChanged += new System.EventHandler(this.SelectedItem);

                oEditorService.DropDownControl(oList);
                if (oList.SelectedIndices.Count == 1)
                {
                    cp.SelectedItem  = oList.SelectedItem;
                    cp.SelectedValue = oSelectedValue;
                    value            = oList.Text;
                }
                oEditorService.CloseDropDown();
            }
            else
            {
                return(base.EditValue(provider, value));
            }

            return(value);
        }
Ejemplo n.º 9
0
        private void InitPropGrid()
        {
            this.pGridPerf.Items.Clear();

            this.mItemStore = new CustomProperty(Translator.Instance.T("存储目录"), MotionConfiguration.Instance.Storage, false, Translator.Instance.T("配置"), Translator.Instance.T("设置存储目录。所有的录像、截图都将存放在该目录下面"), true);
            this.mItemStore.UseFilePathEditor = true;
            this.pGridPerf.Items.Add(this.mItemStore);

            this.mItemFontName = new CustomProperty(Translator.Instance.T("字体"), FontHelper.GetFontFaceName(MotionConfiguration.Instance.FontName), false, Translator.Instance.T("外观"), Translator.Instance.T("设置窗口字体"), true);
            this.mItemFontName.ValueMember = "Key";
            this.mItemFontName.DisplayMember = "Value";
            this.mItemFontName.Datasource = FontHelper.FontList;
            this.pGridPerf.Items.Add(this.mItemFontName);

            float[] slist = new float[] { 4F, 5F, 6F, 7F, 8F, 8.5F, 9F, 9.5F, 10F, 10.5F, 11F, 12F, 13F };
            ArrayList ls = new ArrayList();
            for (int i = 0; i < slist.Length; i++)
            {
                ls.Add(slist[i]);
            }
            this.mItemFontSize = new CustomProperty(Translator.Instance.T("字体大小"), MotionConfiguration.Instance.FontSize, false, Translator.Instance.T("外观"), Translator.Instance.T("设置窗口字体大小"), true);
            this.mItemFontSize.Choices = new CustomChoices(ls);
            this.pGridPerf.Items.Add(this.mItemFontSize);
            this.mPlugIns.PropertyGridItemsInitialization(this.pGridPerf.Items, true);

            this.pGridPerf.Refresh();
            this.pGridPerf.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.pGridPerf_PropertyValueChanged);
        }
Ejemplo n.º 10
0
        private void InitGridItems(List<ZForge.Controls.PropertyGridEx.CustomProperty> list)
        {
            EMailArgs Args = new EMailArgs();

            if (this.GlobalOperation == false)
            {
                mItemUseGlobal = new CustomProperty(Translator.Instance.T("是否使用Email报警全局设置"), this.UseGlobal, false, this.CategoryText,Translator.Instance.T("确定是否使用[使用偏好]中的全局设置"), true);
                list.Add(mItemUseGlobal);
            }

            mItemAction = new CustomProperty(Translator.Instance.T("EMail报警方式"), Args.GetValue(this.Action), false, this.CategoryText, Translator.Instance.T("设置启用或者不启用EMail报警"), true);
            mItemAction.ValueMember = "Key";
            mItemAction.DisplayMember = "Value";
            mItemAction.Datasource = Args.ACTIONS;
            list.Add(mItemAction);

            mItemToAddress = new CustomProperty(Translator.Instance.T("接收者EMail地址"), this.ToAddress, false, this.CategoryText, Translator.Instance.T("设置报警接收者的邮箱地址"), true);
            list.Add(mItemToAddress);

            mItemSmtpAddress = new CustomProperty(Translator.Instance.T("SMTP服务器地址"), this.SMTPAddress, false, this.CategoryText, Translator.Instance.T("设置发送邮件的SMTP服务器地址"), true);
            list.Add(mItemSmtpAddress);

            mItemSmtpPort = new CustomProperty(Translator.Instance.T("SMTP服务器端口"), this.SMTPPort.ToString(), false, this.CategoryText, Translator.Instance.T("设置发送邮件的SMTP服务器端口, 通常为25; 如果是SSL连接, 通常是465; 如果您使用的是Gmail账号, 这里应该设置成25."), true);
            list.Add(mItemSmtpPort);

            mItemUsername = new CustomProperty(Translator.Instance.T("SMTP用户名"), this.Username, false, this.CategoryText, Translator.Instance.T("设置邮件发送的用户名, 如果您使用的是Gmail账号, 这里需要填入完整的Email地址."), true);
            list.Add(mItemUsername);

            mItemPassword = new CustomProperty(Translator.Instance.T("SMTP用户密码"), this.Password, false, this.CategoryText, Translator.Instance.T("设置邮件发送的密码"), true);
            mItemPassword.IsPassword = true;
            list.Add(mItemPassword);

            mItemSSL = new CustomProperty(Translator.Instance.T("是否是SSL连接"), this.SSL, false, this.CategoryText, Translator.Instance.T("设置是否是SSL连接, 如果您使用的是Gmail账号, 请设置为True"), true);
            list.Add(mItemSSL);

            mItemTimeout = new CustomProperty(Translator.Instance.T("邮件发送超时设置"), this.Timeout.ToString(), false, this.CategoryText, Translator.Instance.T("设置邮件发送的超时, 缺省为10秒"), true);
            list.Add(mItemTimeout);

            mItemAttachImage = new CustomProperty(Translator.Instance.T("邮件包含图片"), this.mAttachImage, false, this.CategoryText, Translator.Instance.T("设置在邮件中是否包含图片"), true);
            list.Add(mItemAttachImage);

            foreach (ZForge.Controls.PropertyGridEx.CustomProperty i in list)
            {
                i.Tag = this.ID;
            }
            this.SyncUI();
        }