Пример #1
0
    void Start()
    {
        _minClick     = Random.Range(0, 50);
        _maxClick     = Random.Range(_minClick, 254);
        _timeToChange = Random.Range(500, 2000);


        rend = GetComponent <Renderer>();

        ccd = new ClickColorData(objName, _maxClick, _minClick, _timeToChange, color, this);
        Canvas _canvas = GameObject.Find("Canvas").GetComponent(typeof(Canvas)) as Canvas;

        cc = _canvas.GetComponent <CanvasControll>();
        cc.addObject(ccd);

        Observable.Timer(System.TimeSpan.FromMilliseconds(_timeToChange))
        .Repeat()
        .Subscribe(_ => {
            changeColor();
        });
    }
Пример #2
0
        public MainForm()
        {
            lngResources.Add(strMachine, "Machine:");
            lngResources.Add(strMotion, "Motion:");
            lngResources.Add(strVision, "Vision:");
            lngResources.Add(strLaser, "Laser:");
            lngResources.Add(strScale, "Scale:");
            lngResources.Add(strHeater, "Heater:");
            lngResources.Add(strPropor1, "Propor1:");
            lngResources.Add(strPropor2, "Propor2:");

            //数据库存在
            this.LoadConfig();

            this.MainNav    = new NavigateMain();
            this.ProgramNav = new NavigateProgram();
            this.RunNav     = new NavigateRun();

            this.SetupAlarm();
            //数据库线程启动
            this.SetupDataBase();
            //setup machine
            if (!Machine.Instance.SetupAll())
            {
                return;
            }
            //为了同步气压而增加的事件
            Machine.Instance.Valve1.Proportioner.ChangeProgramAirEvent += FluidProgram.CurrentOrDefault().ChangeAirValue;

            InitializeComponent();
            Ins = this;

            this.WindowState  = FormWindowState.Maximized;
            this.Load        += FormMain_Load;
            this.FormClosing += FormMain_FormClosing;

            this.ProgramCtl      = new ProgramControl();
            this.ProgramCtl.Dock = DockStyle.Fill;
            this.ProgramCtl.SetOwner(this);

            //this.CameraCtl = new CameraControl();
            //this.CameraCtl.Dock = DockStyle.Fill;

            this.ctlCurrPos      = new PositionMainControl();
            this.ctlCurrPos.Dock = DockStyle.Fill;

            this.RunInfoCtl       = new RunInfoControl();
            this.RunInfoCtl.Dock  = DockStyle.Fill;
            this.RunInfoCtl2      = new RunInfoControl2();
            this.RunInfoCtl2.Dock = DockStyle.Fill;

            this.ManualCtl      = new ManualControl();
            this.ManualCtl.Dock = DockStyle.Fill;

            this.canvasControll = new CanvasControll();
            this.canvasControll.SetControlMode(true);
            this.canvasControll.Dock = DockStyle.Fill;

            this.SetupPages();
            this.SetupReceivers();
            this.SetupDrawing();

            ControlUpatingMgr.Add(this);
            Machine.Instance.FSM.StateChanged  += FSM_StateChanged;
            Machine.Instance.LightTower.Opened += LightTower_Opened;

            this.transAlarmForm.SetOwner(this);
            this.createPath();
            this.timer          = new System.Windows.Forms.Timer();
            this.timer.Interval = 100;
            this.timer.Tick    += Timer_Tick;
            this.timer.Start();
            this.ReadLanguageResources();
        }