コード例 #1
0
    //ライトを生成する処理
    public void CreateLights(int size)
    {
        size = Mathf.Clamp(size, minSize, maxSize);

        clearText.enabled    = false;
        lightStatus          = new bool[size, size];
        lightObjects         = new GameObject[size, size];
        grid.constraintCount = size;

        for (int i = 0; i < size; i++)
        {
            for (int j = 0; j < size; j++)
            {
                GameObject button = Instantiate(lightPrefab);
                button.transform.SetParent(lightParent);
                button.transform.localScale = transform.lossyScale;

                LightButton light = button.GetComponent <LightButton>();
                light.row = i;
                light.col = j;

                lightObjects[i, j] = button;
            }
        }

        CreateProblem();
    }
コード例 #2
0
ファイル: Status.aspx.cs プロジェクト: kyvkri/MG
 void updatePanel()
 {
     StringBuilder sb = new StringBuilder();
     DateTime dtLastHotBuild = WMRebuild.GetDateOfLastHotBuild();
     DateTime dtLastFullBuild = WMRebuild.GetDateOfLastFullReBuild();
     sb.Append("<h1 >Last rebuild</h1>");
     sb.Append("<div>");
     if (dtLastFullBuild > dtLastHotBuild && dtLastFullBuild != Utils.DateTimeNull) {
         sb.Append("Last build was a full rebuild and was performed " + dtLastFullBuild + ". " + Utils.GetTimespanString(DateTime.Now.Subtract(dtLastFullBuild)) + " ago. ");
     } else if (dtLastHotBuild > dtLastFullBuild && dtLastHotBuild != Utils.DateTimeNull) {
         sb.Append("Last build was a hot rebuild and was performed " + dtLastHotBuild + ". " + Utils.GetTimespanString(DateTime.Now.Subtract(dtLastFullBuild)) + " ago. ");
         if (WAFRuntime.FileSystem.FileExists(WAFContext.PathCustomDefinitions + "ContentDefinitionsNew.xml")) {
             sb.Append("Codefiles will be updated on next restart.");
             LightButton btnRestart = new LightButton();
             btnRestart.Text = "Restart";
             btnRestart.Click += new EventHandler(btnRestart_Click);
             pnlStatus.Controls.Add(btnRestart);
         } else {
             sb.Append("Codefiles are updated.");
         }
     } else {
         sb.Append("There is no information on last rebuild.");
     }
     sb.Append("</div>");
     litStatus.Text = sb.ToString();
 }
コード例 #3
0
        /**
         * Event handler that toggles the buttons.
         */
        public void LightUp(object sender, EventArgs e)
        {
            LightButton b = (LightButton)sender;

            //Lights up the button clicked.
            b.changeLight();
            //Lights up the button on the left if there is one.
            if (b.TabIndex - 1 >= 0 && b.TabIndex - 5 != 0 && b.TabIndex - 5 != 5 && b.TabIndex - 5 != 10 && b.TabIndex - 5 != 15)
            {
                LightButton left = (LightButton)grid.GetControlFromPosition(grid.GetColumn(b) - 1, grid.GetRow(b));
                left.changeLight();
            }
            //Lights up the button on the right if there is one.
            if (b.TabIndex + 1 <= 24 && b.TabIndex + 1 != 5 && b.TabIndex + 1 != 10 && b.TabIndex + 1 != 15 && b.TabIndex + 1 != 20)
            {
                LightButton right = (LightButton)grid.GetControlFromPosition(grid.GetColumn(b) + 1, grid.GetRow(b));
                right.changeLight();
            }
            //Lights up the button on bottom if there is one
            if (b.TabIndex + 5 <= 24)
            {
                LightButton bottom = (LightButton)grid.GetControlFromPosition(grid.GetColumn(b), grid.GetRow(b) + 1);
                bottom.changeLight();
            }
            //Lights up the button on top if there is one.
            if (b.TabIndex - 5 >= 0)
            {
                LightButton top = (LightButton)grid.GetControlFromPosition(grid.GetColumn(b), grid.GetRow(b) - 1);
                top.changeLight();
            }
        }
コード例 #4
0
 private void ResponseEngine_HandleConfigurationParsedEvent(int temperatureText, int humidityText, bool isFanOn, bool isLightOn, int R, int G, int B)
 {
     ResponseEngine_HandleTempertureEvent(temperatureText);
     ResponseEngine_HandleHumidityEvent(humidityText);
     FanButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isFanOn));
     LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn));
     ColorDialogButton.SetBackgroundColor(new Color(R, G, B));
 }
コード例 #5
0
ファイル: Default.aspx.cs プロジェクト: kyvkri/MG
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (WAFRuntime.Engine.License.GetMontlyCreditLimitAbsolute("mms") > WAFRuntime.Engine.License.GetMontlyCreditUsed("mms")) {
        MainButton btnMMSUpload = new MainButton();
        Form.Controls.Add(btnMMSUpload);
        btnMMSUpload.Text = "MMS...";
        WebDialogueContext.AddDialogueButton(btnMMSUpload);
        btnMMSUpload.Click += new EventHandler(btnMMSUpload_Click);
        //}

        _btnBasicUpload = new LightButton();
        Form.Controls.Add(_btnBasicUpload);
        _btnBasicUpload.Click += new EventHandler(btnBasicUpload_Click);

        init();
    }
コード例 #6
0
        private void OnColorSelected(int color)
        {
            Message message;

            Color = new Color(color);

            message = new Message(Color.R, Color.G, Color.B);
            message.Create();

            communicationService.Write(message.RawBytes);

            ColorDialogButton.SetBackgroundColor(this.Color);
            if (!isLightOn)
            {
                isLightOn = true;
            }

            LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn));
        }
コード例 #7
0
        public Form1()
        {
            InitializeComponent();
            this.Text = "Lights Game - C# (Lewis Williams)";
            //sets up the grid
            grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                 | System.Windows.Forms.AnchorStyles.Left)
                                                                | System.Windows.Forms.AnchorStyles.Right)));
            grid.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            grid.RowCount     = 5;
            grid.ColumnCount  = 5;
            grid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            grid.Size = new System.Drawing.Size(600, 400);
            Controls.Add(grid);

            //adds the buttons
            int tabIndex = 0;

            for (int row = 0; row < 5; row++)
            {
                for (int column = 0; column < 5; column++)
                {
                    LightButton button = new LightButton();
                    button.Name     = tabIndex.ToString();
                    button.TabIndex = tabIndex;
                    button.Anchor   = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
                    button.Click += new EventHandler(LightUp);
                    grid.Controls.Add(button, column, row);
                    tabIndex++;
                }
            }
        }
コード例 #8
0
        private void HaikuLightSwitch_Click(object sender, RoutedEventArgs e)
        {
            LightButton.Foreground = MainWindow.buttonForeground;
            HaikuButton.Foreground = MainWindow.buttonForeground;
            SMTButton.Foreground   = MainWindow.buttonForeground;

            if (sender.ToString() == LightButton.ToString())
            {
                LightButton.Foreground = MainWindow.activeBackground;
                FadeLotGrid(true);
            }
            if (sender.ToString() == HaikuButton.ToString())
            {
                HaikuButton.Foreground = MainWindow.activeBackground;
                FadeLotGrid(false);
            }
            if (sender.ToString() == SMTButton.ToString())
            {
                SMTButton.Foreground = MainWindow.activeBackground;
                FadeLotGrid(false);
            }
        }
コード例 #9
0
        private void ButtonLightCommand_Click(object sender, System.EventArgs e)
        {
            Message message;

            if (isLightOn == false)
            {
                message = new Message((byte)CommandCode.LightOn, Color.R, Color.G, Color.B);
                message.Create();

                isLightOn = true;
            }
            else
            {
                message = new Message((byte)CommandCode.LightOff);
                message.Create();

                isLightOn = false;
            }
            communicationService.Write(message.RawBytes);

            LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn));
        }
コード例 #10
0
        private void UpdateFileNamesList()
        {
            FileNamesSp.Children.Clear();

            string[] names = textureManager.GetFileNames();

            for (int i = 0; i < names.Length; i++)
            {
                LightButton btn = new LightButton()
                {
                    Content    = (i + 1).ToString() + ") " + names[i],
                    ShowIcon   = false,
                    Background = new SolidColorBrush(Color.FromArgb(0, 255, 255, 255)),
                    HorizontalContentAlignment = HorizontalAlignment.Left
                };

                btn.Click += Btn_Click;

                FileNamesSp.Children.Add(btn);
            }

            FoundLbl.Content = "Founded files: " + textureManager.LoadedTexturesCount.ToString();
        }
コード例 #11
0
ファイル: Default.aspx.cs プロジェクト: kyvkri/mg-git
    protected void Page_Load(object sender, EventArgs e)
    {
        _requireSelection = (bool)WebDialogueContext.DialogueParameters["RequireSelection"];
        if (!IsPostBack) {
            if (WAFRuntime.Installation.EnableTextIndex) {
                var searchIn = WAFContext.Session.GetSetting<string>("DialogueFindContentSearchIn", PersistenceScope.User, "NameAndText");
                rbtnInclude.SelectedValue = searchIn;
            } else {
                rbtnInclude.SelectedValue = "Name";
            }
        }
        txtNameSearch.Focus();
        chkEditAccess.CheckedChanged += new EventHandler(chkEditAccess_CheckedChanged);
        chkPublishAccess.CheckedChanged += new EventHandler(chkPublishAccess_CheckedChanged);
        MainButton btn = new MainButton();
        Controls.Add(btn);
        _allSitesByDefault = (bool)WebDialogueContext.DialogueParameters["AllSitesByDefault"];
        btn.Text = WebDialogueContext.DialogueParameters["ButtonTextSelect"].ToString();
        btn.Click += new EventHandler(btn_Click);

        if (_requireSelection) {
            if (filterKey == null) {
                MainButton btnFilter = new MainButton();
                Controls.Add(btnFilter);
                btnFilter.Text = "Filter...";
                btnFilter.Click += new EventHandler(btnAddFilter_Click);
                WebDialogueContext.AddDialogueButton(btnFilter);
            } else {
                MainButton btnEditFilter = new MainButton();
                Controls.Add(btnEditFilter);
                btnEditFilter.Text = "Edit filter...";
                btnEditFilter.Click += new EventHandler(btnEditFilter_Click);
                WebDialogueContext.AddDialogueButton(btnEditFilter);
                MainButton btnRemoveFilter = new MainButton();
                Controls.Add(btnRemoveFilter);
                btnRemoveFilter.Text = "Clear filter";
                btnRemoveFilter.Click += new EventHandler(btnRemoveFilter_Click);
                WebDialogueContext.AddDialogueButton(btnRemoveFilter);
                MainButton btnRefresh = new MainButton();
                Controls.Add(btnRefresh);
                btnRefresh.Text = "Refresh";
                WebDialogueContext.AddDialogueButton(btnRefresh);
            }
        }

        WebDialogueContext.AddDialogueButton(btn);
        if ((bool)WebDialogueContext.DialogueParameters["IncludeSelectAllButton"]) {
            MainButton btnAll = new MainButton();
            Controls.Add(btnAll);
            btnAll.Text = WebDialogueContext.DialogueParameters["ButtonTextSelectAll"].ToString();
            btnAll.Click += new EventHandler(btnAll_Click);
            WebDialogueContext.AddDialogueButton(btnAll);
        }
        // Languages
        if (WAFRuntime.Engine.Definition.Culture.Count > 1) {
            chkDerived.Visible = true;
        } else {
            chkDerived.Visible = false;
        }
        // Hidden
        chkHidden.Visible = WAFContext.Session.Access.IsAdmin();
        if (!IsPostBack) chkHidden.Checked = ((AqlQuery)WebDialogueContext.DialogueParameters["Query"]).IncludeHiddenNodes;

        // Options
        if (!IsPostBack) {
            txtNameSearch.Text = WebDialogueContext.DialogueParameters["NameSearch"].ToString();
            btnOptions.Text = _optionsMore;
            pnlOptions.Height = Unit.Pixel(_lessHeight);
            pnlOptionControls.Visible = false;

            var showOptions = WAFContext.Session.GetSetting<bool>("DialogueFindContentShowOptions", PersistenceScope.User, true);
            if (showOptions) btnLight_OnClick(sender, e);

        }
        contentList.SelectionMode = (ListSelectionMode)WebDialogueContext.DialogueParameters["SelectionMode"];
        UniqueList<int> classIds = (UniqueList<int>)WebDialogueContext.DialogueParameters["ClassIds"];
        _includeDerivated = (bool)WebDialogueContext.DialogueParameters["IncludeDerivated"];
        contentList.DblClick += new EventHandler(btn_Click);
        if (!IsPostBack) {
            if (_includeDerivated) {
                chkIncDescTypes.Checked = true;
            } else {
                chkIncDescTypes.Enabled = false;
            }
        }
        // Sites
        if (!IsPostBack) {
            List<Site> sites = WAFContext.Session.GetContents<Site>();
            lstSites.Items.Add(new ListItem("[All sites]", "0"));
            foreach (Site s in sites) {
                if (WAFContext.Session.Access.IsMember(s.AccessInEditMode)) {
                    lstSites.Items.Add(new ListItem(s.Name, s.NodeId.ToString()));
                }
            }
            if (_allSitesByDefault) {
                lstSites.SelectedValue = "0";
            } else {
                lstSites.SelectedValue = WAFContext.Session.SiteId.ToString();
            }
            if (lstSites.Items.Count < 3) {
                pnlSites.Visible = false;
            }
        }
        // Edit Access
        if (!IsPostBack) {
            chkEditAccess.Checked = !_allSitesByDefault;
        }

        // Types
        if (!IsPostBack) {
            refreshTypeList();
        } else {
            refreshTypeList();
        }

        LightButton btnNew = new LightButton();
        btnNew.Text = "New...";
        pnlListCommands.Controls.Add(btnNew);
        if (_includeDerivated) {
            Dictionary<int, MemDefContentClass> fullList = new Dictionary<int, MemDefContentClass>();
            foreach (int id in classIds) fullList.Add(id, WAFContext.Session.Definitions.ContentClass[id]);

            List<MemDefContentClass> secondList = new List<MemDefContentClass>();
            foreach (MemDefContentClass c in fullList.Values) secondList.Add(c);

            foreach (MemDefContentClass c in secondList) {
                foreach (int id in c.AllDescendantsIncThis) {
                    if (!fullList.ContainsKey(id)) fullList.Add(id, WAFContext.Session.Definitions.ContentClass[id]);
                }
            }
            btnNew.SetWorkflowMethod<NewContent>(new UniqueList<int>(fullList.Keys));
        } else {
            btnNew.SetWorkflowMethod<NewContent>(classIds);
        }
        btnNew.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(btnNew_WorkflowMethodCompleted);

        LightButton btnEdit = new LightButton();
        btnEdit.Text = "Open in window...";
        btnEdit.Click += new EventHandler(btnEdit_Click);
        pnlListCommands.Controls.Add(btnEdit);

        LightButton btnEditDesktop = new LightButton();
        btnEditDesktop.Text = "Open in module";
        btnEditDesktop.Click += new EventHandler(btnEditDesktop_Click);
        pnlListCommands.Controls.Add(btnEditDesktop);

        LightButton btnLinks = new LightButton();
        btnLinks.Text = "Examine links...";
        btnLinks.Click += new EventHandler(btnLinks_Click);
        pnlListCommands.Controls.Add(btnLinks);

        LightButton btnDelete = new LightButton();
        btnDelete.Text = "Delete...";
        btnDelete.Click += new EventHandler(btnDelete_Click);
        pnlListCommands.Controls.Add(btnDelete);
    }
コード例 #12
0
ファイル: Enumerations.aspx.cs プロジェクト: kyvkri/mgone
    protected override void CreateChildControls()
    {
        Controls.Clear();
        if (currentDef != null) {

            // Buttons
            WAFPanel pnlButtons = new WAFPanel();
            pnlButtons.Height = Unit.Pixel(25);
            pnlButtons.Border = false;
            if (writeAccess || currentDef.IsChangeDef) {
                MainButton btnSave = new MainButton();
                btnSave.Text = "Save";
                btnSave.Click += new EventHandler(btnSave_Click);
                pnlButtons.Controls.Add(btnSave);

                MainButton btnEditAsTextFile = new MainButton();
                btnEditAsTextFile.Text = "Edit values as text table...";
                btnEditAsTextFile.Click += new EventHandler(btnEditAsTextFile_Click);
                pnlButtons.Controls.Add(btnEditAsTextFile);

                if (DefinitionType == DefinitionType.Local) {
                    MainButton btnDelete = new MainButton();
                    btnDelete.Confirm = true;
                    if (currentDef.IsChangeDef) {
                        btnDelete.Text = "Delete enumeration changes...";
                        btnDelete.ConfirmQuestion = "Delete changes to native enumeration \"" + bestDef.CodeName + "\"?";
                    } else {
                        btnDelete.ConfirmQuestion = "Delete enumeration \"" + currentDef.CodeName + "\"?";
                        btnDelete.Text = "Delete enumeration...";
                    }
                    btnDelete.Click += new EventHandler(btnDelete_Click);
                    pnlButtons.Controls.Add(btnDelete);
                }
            }
            if (DefinitionType == DefinitionType.Native) {
                //MainButton btnNewChangeEnumeration = new MainButton();
                //btnNewChangeEnumeration.Text = "Change";
                //btnNewChangeEnumeration.Click += new EventHandler(btnNewChangeEnumeration_Click);
                //pnlButtons.Controls.Add(btnNewChangeEnumeration);
            }
            Controls.Add(pnlButtons);

            // Code name
            txtCodeName = new TextBox();
            txtCodeName.Width = Unit.Percentage(100);
            txtCodeName.Font.Size = new FontUnit(14, UnitType.Pixel);
            txtCodeName.Text = bestDef.CodeName;
            txtCodeName.Enabled = !currentDef.IsChangeDef && writeAccess;

            StringBuilder htmlIcon = new StringBuilder();
            htmlIcon.Append("<img style=\"float:left; margin:5px 2px; 0px 0px;\" src=\"");
            htmlIcon.Append(IconUrl);
            htmlIcon.Append("\" height=\"16\" width=\"16\" />");
            PropertyPanel ppCodeName = new PropertyPanel(txtCodeName, PropertyLayout.TwoColumns, htmlIcon.ToString(), null);
            ppCodeName.TitleWidth = Unit.Pixel(50);
            ppCodeName.Height = Unit.Pixel(45);
            ppCodeName.ShowAdvancedFunctions = false;
            Controls.Add(ppCodeName);
            ppCodeName.Border = true;
            ppCodeName.MarginTop = true;

            TabbedView tab = new TabbedView();
            this.Controls.Add(tab);
            tab.PostOnViewChange = false;
            tab.MarginTop = true;
            tab.Height = Unit.Percentage(100);
            tab.Width = Unit.Percentage(100);
            TabView general = tab.CreateAndAddView("General", "General");

            // Namespace
            txtNameSpace = new TextBox();
            txtNameSpace.Width = Unit.Percentage(100);
            txtNameSpace.Enabled = !currentDef.IsChangeDef && writeAccess;
            txtNameSpace.Text = bestDef.Namespace;
            PropertyPanel ppNameSpace = new PropertyPanel(txtNameSpace, PropertyLayout.TwoColumns, "Namespace", null);
            ppNameSpace.ShowAdvancedFunctions = false;
            general.Controls.Add(ppNameSpace);

            TabView tNames = tab.CreateAndAddView("Names", "Names");
            // Language versions
            langVersions = new LanguageVersions();
            langVersions.SetData(currentDef.NameByLCID, currentDef.DescriptionByLCID);
            PropertyPanel ppLangVersion = new PropertyPanel(langVersions, PropertyLayout.NoTitle, "Friendly names and descriptions:", null);
            langVersions.Enabled = writeAccess;
            ppLangVersion.Layout = PropertyLayout.NoTitle;
            tNames.Controls.Add(ppLangVersion);

            TabView tValues = tab.CreateAndAddView("Values", "Values");
            WAFPanel p = new WAFPanel();
            p.Width = Unit.Percentage(100);
            p.Height = Unit.Percentage(100);
            p.Border = false;
            p.ScrollBars = ScrollBars.Auto;
            enumControls = new List<EnumerationValueControl>();
            foreach (var v in bestDef.Values.Values) {
                var c = new EnumerationValueControl();
                c.SetData(v.Value, v.CodeName, v.NameByLCID, v.DescriptionByLCID, writeAccess);
                enumControls.Add(c);
                p.Controls.Add(c);
            }
            tValues.Controls.Add(p);

            _btnAddValue = new LightButton();
            _btnAddValue.Text = "Add enumeration value";
            _btnAddValue.Enabled = writeAccess;
            if (writeAccess) _btnAddValue.Click += new EventHandler(btnAddValue_Click);
            p.Controls.Add(_btnAddValue);

            base.CreateChildControls();

        }
    }
コード例 #13
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            UserLevelChangeEvent += UserLevelChange;
            Global.userLevel      = UserLevel.操作员;
            OnUserLevelChange(Global.userLevel);

            new Thread(new ThreadStart(() =>
            {
                frmStarting loading = new frmStarting(8);
                LoadingMessage     += new Action <string>(loading.ShowMessage);
                loading.ShowDialog();
            })).Start();
            Thread.Sleep(500);

            Config.Instance = SerializerManager <Config> .Instance.Load(AppConfig.ConfigIntrinsicProductPathdName);

            AxisParameter.Instance = SerializerManager <AxisParameter> .Instance.Load(AppConfig.ConfigIntrinsicParamAxisCardName);

            #region  加载板卡

            LoadingMessage("加载板卡信息");
            try
            {
                IoPoints.ApsController.Initialize();
                if (!IoPoints.ApsController.LoadParamFromFile(AppConfig.ConfigAxisCardName("Param0.cfg")))
                {
                    AppendText("配置文件失败:请将轴卡的配置文件" + ".cfg " + "拷贝到当前型号的路径下" + AppConfig.ConfigAxisCardName("Param0.cfg"));
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.Message);
                AppendText("板卡初始化失败!请检查硬件!");
                timer1.Enabled = false;
            }
            #endregion

            #region 气缸信息

            LoadingMessage("加载气缸资源");
            var SwichCylinder = new DoubleCylinder(IoPoints.S15, IoPoints.S16, IoPoints.Y13, IoPoints.Y14)
            {
                Name      = "切换气缸",
                Delay     = Delay.Instance.SwitchCylinderDelay,
                Condition = new CylinderCondition(() => { return(true); }, () => { return(true); })
                {
                    External = m_External
                }
            };
            var LeftCylinder = new DoubleCylinder(IoPoints.S15, IoPoints.S16, IoPoints.Y13, IoPoints.Y14)
            {
                Name      = "左负压",
                Delay     = Delay.Instance.LeftCylinderDelay,
                Condition = new CylinderCondition(() => { return(true); }, () => { return(true); })
                {
                    External = m_External
                }
            };
            var RightCylinder = new DoubleCylinder(IoPoints.S15, IoPoints.S16, IoPoints.Y13, IoPoints.Y14)
            {
                Name      = "右负压",
                Delay     = Delay.Instance.RightCylinderDelay,
                Condition = new CylinderCondition(() => { return(true); }, () => { return(true); })
                {
                    External = m_External
                }
            };
            #endregion
            DM50S = new DM50S()
            {
                Name = "扫描枪"
            };
            try
            {
                DM50S.SetConnectionParam(Config.Instance.ReadCodePortConnectParam);
                DM50S.DeviceDataReceiveCompelete += new DataReceiveCompleteEventHandler(DealWithScrewDeviceReceiveData);
                DM50S.DeviceOpen();
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}连接失败:{1}", DM50S.Name, ex.Message));
            }

            #region 轴信息

            LoadingMessage("加载轴控制资源");

            var XaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 0,
                Transmission      = AxisParameter.Instance.XTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeXVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.XVelocityCurve,
                Speed             = 11,
                Name              = "相机X轴"
            };
            XaxisServo._condition = new Func <bool>(() =>
            {
                return(true);
            });
            var YaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 1,
                Transmission      = AxisParameter.Instance.YTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeYVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.YVelocityCurve,
                Speed             = 11,
                Name              = "治具Y轴"
            };
            YaxisServo._condition = new Func <bool>(() => { return(true); });

            var ZaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 2,
                Transmission      = AxisParameter.Instance.ZTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeZVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.ZVelocityCurve,
                Speed             = 11,
                Name              = "升降Z轴"
            };
            ZaxisServo._condition = new Func <bool>(() => { return(true); });
            var LFXaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 3,
                Transmission      = AxisParameter.Instance.LFXTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeLFXVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.LFXVelocityCurve,
                Speed             = 11,
                Name              = "相机左前X轴"
            };
            LFXaxisServo._condition = new Func <bool>(() => { return(true); });
            var LFYaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 4,
                Transmission      = AxisParameter.Instance.LFYTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeLFYVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.LFYVelocityCurve,
                Speed             = 11,
                Name              = "相机左前Y轴"
            };
            LFYaxisServo._condition = new Func <bool>(() => { return(true); });
            var LRXaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 5,
                Transmission      = AxisParameter.Instance.LRXTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeLRXVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.LRXVelocityCurve,
                Speed             = 11,
                Name              = "相机左后X轴"
            };
            LRXaxisServo._condition = new Func <bool>(() => { return(true); });
            var LRYaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 6,
                Transmission      = AxisParameter.Instance.LRYTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeLRYVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.LRYVelocityCurve,
                Speed             = 11,
                Name              = "相机左后Y轴"
            };
            LRYaxisServo._condition = new Func <bool>(() => { return(true); });
            var RYaxisServo = new StepAxis(IoPoints.ApsController)
            {
                NoId              = 7,
                Transmission      = AxisParameter.Instance.RYTransParams,
                VelocityCurveHome = AxisParameter.Instance.HomeRYVelocityCurve,
                VelocityCurveRun  = AxisParameter.Instance.RYVelocityCurve,
                Speed             = 11,
                Name              = "相机右Y轴"
            };
            RYaxisServo._condition = new Func <bool>(() => { return(true); });
            #endregion


            #region 工站模组操作

            LoadingMessage("加载模组操作资源");

            var Station1Initialize = new StationInitialize(
                () => { return(!ManualAutoMode); },
                () => { return(Station1IsAlarm.IsAlarm); });
            var Station1Operate = new StationOperate(
                () => { return(Station1Initialize.InitializeDone); },
                () => { return(Station1IsAlarm.IsAlarm); });



            MachineOperation = new MachineOperate(() =>
            {
                return(Station1Initialize.InitializeDone);
            }, () =>
            {
                return(Station1IsAlarm.IsAlarm | MachineIsAlarm.IsAlarm);
            });
            #endregion

            #region 雅马哈机器人
            yamaha = new Yamaha();
            if (!yamaha.Connect(Config.Instance.YamahaIP, Config.Instance.Port))
            {
                AppendText("机器人连接失败!");
            }
            #endregion

            #region 模组信息加载、启动

            LoadingMessage("加载模组信息");
            m_station1 = new Station1(m_External, Station1Initialize, Station1Operate)
            {
                mAlarmManage  = mAlarmManage,
                XaxisServo    = XaxisServo,
                YaxisServo    = YaxisServo,
                ZaxisServo    = ZaxisServo,
                LFXaxisServo  = LFXaxisServo,
                LFYaxisServo  = LFYaxisServo,
                LRXaxisServo  = LRXaxisServo,
                LRYaxisServo  = LRYaxisServo,
                RYaxisServo   = RYaxisServo,
                YAMAHA        = yamaha,
                SwichCylinder = SwichCylinder,
                LeftVacuum    = LeftCylinder,
                RightVacuum   = RightCylinder
            };
            m_station1.AddPart();
            m_station1.Run(RunningModes.Online);

            #endregion

            LoadingMessage("加载MES资源");
            #region 加载信号灯资源
            StartButton = new LightButton(IoPoints.S1, IoPoints.Y1);
            ResetButton = new LightButton(IoPoints.S2, IoPoints.Y10);
            PauseButton = new LightButton(IoPoints.S5, IoPoints.Y11);
            EstopButton = new EventButton(IoPoints.S3);
            StopButton  = new LightButton(IoPoints.S4, IoPoints.Y12);


            layerLight = new LayerLight(IoPoints.Y11, IoPoints.Y10, IoPoints.Y9, IoPoints.Y12);

            StartButton.Pressed  += btnStart_MouseDown;
            StartButton.Released += btnStart_MouseUp;
            PauseButton.Pressed  += btnPause_MouseDown;
            PauseButton.Released += btnPause_MouseUp;
            ResetButton.Pressed  += btnReset_MouseDown;
            ResetButton.Released += btnReset_MouseUp;

            MachineOperation.StartButton = StartButton;
            MachineOperation.PauseButton = PauseButton;
            MachineOperation.StopButton  = StopButton;
            MachineOperation.ResetButton = ResetButton;
            MachineOperation.EstopButton = EstopButton;
            #endregion
            ManualAutoMode = false;
            LoadingMessage("加载线程资源");
            SerialStart();

            timer1.Enabled = true;
        }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) txtNameSearch.Focus();

        List<int> libraryNodeIds;
        List<int> baseIds;
        if (WAFRuntime.Context == WAFRuntimeContext.WebDialogue) {
            baseIds = (List<int>)WebDialogueContext.DialogueParameters["ContentFileClassIds"];
            libraryNodeIds = (List<int>)WebDialogueContext.DialogueParameters["LibraryNodeIds"];
            // filter nodes with ones user has read access to:
        } else {
            libraryNodeIds = WAFContext.Session.GetContent<Site>(WAFContext.Session.SiteId).FileLibraries.GetNodeIds(false, false);
            baseIds = WAFRuntime.Definitions.ContentClass[ContentFile.ContentClassId].AllDescendantsIncThis.ToList();
        }
        var filtered = from id in libraryNodeIds where WAFContext.Session.HasReadAccessToNode(id) select id;
        libraryNodeIds = new List<int>(filtered);
        if (!IsPostBack) {
            btnOptions.Text = _optionsMore;
            pnlOptions.Height = Unit.Pixel(_lessHeight);
            pnlOptionControls.Visible = false;
            lstFiles.ViewMode = ListViewOptions.Thumbnails;
        }
        if (libraryNodeIds.Count == 0) return;
        treeFolders.RelationId = RelFilefolders.RelationId;
        if (!IsPostBack) {
            foreach (FileLibrary fl in WAFContext.Session.GetContents<FileLibrary>(libraryNodeIds)) {
                ddlLibrary.Items.Add(new ListItem(fl.Name, fl.NodeId.ToString()));
            }
            ddlLibrary.SelectedIndex = 0;
        }
        if (WAFContext.Session.NodeExists(int.Parse(0 + ddlLibrary.SelectedValue), true, true)) {
            treeFolders.RootKey = WAFContext.Session.CompleteKeyC(int.Parse(ddlLibrary.SelectedValue));
        }
        if (!IsPostBack) {
            Dictionary<int, MemDefContentClass> allInherited = new Dictionary<int, MemDefContentClass>();
            foreach (int id in baseIds) {
                MemDefContentClass cdef = WAFRuntime.Definitions.ContentClass[id];
                foreach (int id2 in cdef.AllDescendantsIncThis) {
                    if (!allInherited.ContainsKey(id2)) allInherited.Add(id2, WAFRuntime.Definitions.ContentClass[id2]);
                }
            }
            var classList = from r in allInherited.Values orderby r.GetName(WAFContext.Session) select r;
            lstFilterType.Items.Add(new ListItem(Local.Text("Web.WAF.Edit.FileLibrary.AllTypes"), ""));
            List<int> indents = new List<int>();
            foreach (MemDefContentClass c in classList) lstFilterType.Items.Add(new ListItem(c.GetName(WAFContext.Session), c.Id.ToString()));
            lstFilterType.SelectedIndex = 0;
            chkShowFolders.Checked = WAFContext.Session.GetSetting<bool>("DialogueFileLibraryShowFolders", PersistenceScope.User, true);
        }

        btnNewFolder = new LightButton();
        btnNewFolder.Text = Local.Text("Web.WAF.Edit.FileLibrary.New");
        pnlTreeCommands.Controls.Add(btnNewFolder);
        btnNewFolder.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(btnNewFolder_WorkflowMethodCompleted);

        btnEditFolder = new LightButton();
        btnEditFolder.Text = Local.Text("Web.WAF.Edit.FileLibrary.Edit");
        pnlTreeCommands.Controls.Add(btnEditFolder);

        btnDeleteFolder = new LightButton();
        btnDeleteFolder.Click += new EventHandler(btnDeleteFolder_Click);
        btnDeleteFolder.Text = Local.Text("Web.WAF.Edit.FileLibrary.Delete");
        pnlTreeCommands.Controls.Add(btnDeleteFolder);

        btnUploadFiles = new LightButton();
        btnUploadFiles.Text = Local.Text("Web.WAF.Edit.FileLibrary.Upload");
        pnlListCommands.Controls.Add(btnUploadFiles);

        btnUploadArchive = new LightButton();
        btnUploadArchive.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(btnUploadArchive_WorkflowMethodCompleted);
        btnUploadArchive.Text = Local.Text("Web.WAF.Edit.FileLibrary.UploadZip");
        pnlListCommands.Controls.Add(btnUploadArchive);

        btnDeleteFile = new LightButton();
        btnDeleteFile.Text = Local.Text("Web.WAF.Edit.FileLibrary.Delete");
        btnDeleteFile.Click += new EventHandler(btnDeleteFile_Click);
        pnlListCommands.Controls.Add(btnDeleteFile);

        btnEditFile = new LightButton();
        btnEditFile.Text = Local.Text("Web.WAF.Edit.FileLibrary.Edit");
        btnEditFile.Click += new EventHandler(btnEditFile_Click);
        pnlListCommands.Controls.Add(btnEditFile);

        if (treeFolders.GetSelectedCount() == 0) {
            btnNewFolder.Visible = false;
            btnEditFolder.Visible = false;
            btnDeleteFolder.Visible = false;
        } else {
            btnNewFolder.Visible = true;
            btnEditFolder.Visible = true;
            btnDeleteFolder.Visible = true;
        }

        setWorkflowScripts();
    }
コード例 #15
0
ファイル: Status.aspx.cs プロジェクト: kyvkri/MG
 void updatePanelXml()
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("<div style=\"clear:both;\"></div><h1 title=\"Definitions stored as a temporary XML file. \">Temporary XML definitions:</h1>");
     sb.Append("<h2 >Status: ");
     DefinitionStatus statusXml = WMRebuild.GetDefinitionStatusXml();
     switch (statusXml) {
         case DefinitionStatus.NotCreated: sb.Append("<span style=\"color:gray\">Not created</span>"); break;
         case DefinitionStatus.InSyncWithCurrent: sb.Append("<span style=\"color:green\">In sync with current</span>"); break;
         case DefinitionStatus.OlderThanCurrent: sb.Append("<span style=\"color:red\">Older than current</span>"); break;
         case DefinitionStatus.NewerThanCurrent: sb.Append("<span style=\"color:orange\">Newer than current</span>"); break;
         default: break;
     }
     sb.Append("</h2>");
     litStatusXml.Text = sb.ToString();
     switch (statusXml) {
         case DefinitionStatus.NotCreated:
             LightButton btnCreate = new LightButton();
             btnCreate.Text = "Create...";
             btnCreate.Click += new EventHandler(btnCreateXml_Click);
             pnlStatusXml.Controls.Add(btnCreate);
             break;
         case DefinitionStatus.InSyncWithCurrent:
             LightButton btnEditXml = new LightButton();
             btnEditXml.Text = "Edit...";
             btnEditXml.Click += new EventHandler(btnEditXml_Click);
             pnlStatusXml.Controls.Add(btnEditXml);
             break;
         case DefinitionStatus.OlderThanCurrent:
             LightButton btnDelete = new LightButton();
             btnDelete.Text = "Delete...";
             btnDelete.Click += new EventHandler(btnDeleteXml_Click);
             pnlStatusXml.Controls.Add(btnDelete);
             break;
         case DefinitionStatus.NewerThanCurrent:
             LightButton btnFullRebuild = new LightButton();
             btnFullRebuild.Text = "Full rebuild...";
             btnFullRebuild.Click += new EventHandler(btnFullRebuildXml_Click);
             pnlStatusXml.Controls.Add(btnFullRebuild);
             LightButton btnHotRebuild = new LightButton();
             btnHotRebuild.Text = "Hot rebuild...";
             btnHotRebuild.Click += new EventHandler(btnHotRebuildXml_Click);
             pnlStatusXml.Controls.Add(btnHotRebuild);
             btnEditXml = new LightButton();
             btnEditXml.Text = "Edit...";
             btnEditXml.Click += new EventHandler(btnEditXml_Click);
             pnlStatusXml.Controls.Add(btnEditXml);
             break;
         default:
             break;
     }
 }