예제 #1
0
 private void gaugeForm_Load_1(object sender, EventArgs e)
 {
     manager.initForm();
 }
        public digitalDisplayForm(StartForm parent, XmlNode initData)
        {
            InitializeComponent();
            _display = new YDigitalDisplay(rendererCanvas, LogManager.Log);
            _display.getCaptureParameters = constants.getCaptureParametersCallback;
            _display.DisableRedraw();
            _display.valueFormater = valueFormater;
            noDataSourcepanel      = _display.addMessagePanel();
            noDataSourcepanel.text = "No data source configured\n"
                                     + " 1 - Make sure you have a Yoctopuce sensor connected.\n"
                                     + " 2 - Do a right-click on this window.\n"
                                     + " 3 - Choose \"Configure this digital display\" to bring up the properties editor.\n"
                                     + " 4 - Choose a data source\n";


            prop     = new digitalDisplayFormProperties(initData, this);
            manager  = new formManager(this, parent, initData, "digital display", prop);
            mainForm = parent;

            if (AnnotationPanelCount == 0)
            {
                foreach (var p in typeof(digitalDisplayFormProperties).GetProperties())
                {
                    string name = p.Name;
                    if (name.StartsWith("display_annotationPanels"))
                    {
                        AnnotationPanelCount++;
                    }
                }
            }
            for (int i = 0; i < AnnotationPanelCount; i++)
            {
                _display.addAnnotationPanel();
            }

            _display.setPatchAnnotationCallback(AnnotationCallback);

            initDataNode = initData;
            prop.ApplyAllProperties(this);
            if (!manager.initForm())
            {
                Rectangle s = Screen.FromControl(this).Bounds;
                this.Location = new Point((s.Width - this.Width) >> 1, (s.Height - this.Height) >> 1);
            }
            YDataRenderer.minMaxCheckDisabled = true;
            try { prop.ApplyAllProperties(_display); }
            catch (TargetInvocationException e) { LogManager.Log("DigitalDisplay initialization raised an exception (" + e.InnerException.Message + ")"); }
            YDataRenderer.minMaxCheckDisabled = false;



            manager.configureContextMenu(this, contextMenuStrip1, showConfiguration, switchConfiguration, capture);
            _display.resetRefrenceSize();
            _display.AllowPrintScreenCapture          = true;
            _display.proportionnalValueChangeCallback = manager.proportionalValuechanged;
            _display.resizeRule = Proportional.ResizeRule.RELATIVETOBOTH;
            _display.AllowRedraw();
            _display.OnDblClick += RendererCanvas_DoubleClick;
            if (constants.OSX_Running)
            {
                _display.OnRightClick += rendererCanvas_RightClick;
            }
        }