Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FormRecipe"/> class.
        /// </summary>
        /// <param name="form">The form.</param>
        public FormRecipe(Form form)
        {
            parentForm = form;
            InitializeComponent();

            adsServer = MainApp.GetDoc().AdsPlcServer;
            adsServer.TcPlcStateChanged += new TcAdsStateChangedEventHandler(adsServer_TcPlcStateChanged);

            tclm = MainApp.GetDoc().GetTCLanguageManager();
            tcRecipe1.LanguageManager = tclm;
            tcRecipe1.afterRead      += new TcRecipeGrid.TcAfterReadDelegate(tcRecipe1_afterRead);
            tcRecipe1.afterChange    += new TcRecipeGrid.TcAfterChangeDelegate(tcRecipe1_afterChange);
            tcRecipe1.ConfigFileName  = Application.StartupPath + "\\" + folder + "\\RecipeConfig.xml";

            treeView1.Nodes.Clear();
            treeView1.Nodes.Add(folder);                    // folder = root folder

            if (!System.IO.Directory.Exists(Application.StartupPath + "\\" + folder))
            {
                System.IO.Directory.CreateDirectory(Application.StartupPath + "\\" + folder);
            }

            string[] directories = System.IO.Directory.GetDirectories(Application.StartupPath + "\\" + folder);
            foreach (string dirs in directories)
            {
                string[] sa   = dirs.Split('\\');
                string   name = sa[sa.Length - 1];                        // the last element is the pure filename
                treeView1.Nodes[0].Nodes.Add(name, name);
            }
            treeView1.Nodes[0].ExpandAll();
            rootdir = Application.StartupPath + "\\" + folder;

            treeView1.SelectedNode = treeView1.Nodes[0];
        }
Esempio n. 2
0
        private void timerListbox_Tick(object sender, EventArgs e)
        {
            timerListbox.Enabled = false;
            if ((tcRecipe1 != null) && (treeView2.SelectedNode != null))
            {
                if (hasChanged)
                {
                    if (askSaveData())
                    {
                        tcRecipe1.WriteData();
                    }
                    hasChanged = false;
                    MainApp.GetDoc().tcFKey1.FKeyBackColor(10, oldButtonColor);
                }
                recipeFilename = rootdir + "\\" + treeView2.SelectedNode.Text + ending;
                tcRecipe1.ReadData(recipeFilename);
            }

            string[] sa = rootdir.Split('\\');
            textBoxKunde.Text = sa[sa.Length - 1];                      // the last element is the pure filename
            if (treeView2.SelectedNode != null)
            {
                textBoxAuftrag.Text = treeView2.SelectedNode.Text;
            }
        }
Esempio n. 3
0
        private void RestoreChannelStatus()
        {
            int selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
            int nIdx            = 0;

            // Reads the status and restore after activation
            //int nOpMode = MainApp.GetDoc().header1.tcChannelStatus1.AdsServer.Clients.Channel[selectedChannel].CmdOpMode;
            int nOpMode = adsNcServer.NcClient.Channel[selectedChannel].CmdOpMode;

            switch ((Beckhoff.Forms.Nc.OperationMode)nOpMode)
            {
            case OperationMode.Automatic: nIdx = 1; break;

            case OperationMode.Manual: nIdx = 2; break;

            case OperationMode.MDI: nIdx = 3; break;

            case OperationMode.Reference: nIdx = 4; break;

            default: nIdx = -1; break;
            }
            // deselect the manual mode if selected
            ManualModeSelected(false);
            SetFKeyOpModeStatus(nIdx);
        }
Esempio n. 4
0
        private void Stop_SyntaxCheck()
        {
            if (Enabled == false)
            {
                return;
            }

            try
            {
                if (adsServer != null && adsServer.PlcIsRunning)
                {
                    int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
                    string plcVar          = ".PLCMachineMode[" + selectedChannel.ToString() + "].SyntaxCheck";

                    // Syntax Check OFF
                    adsPlc.WriteSymbol(plcVar + ".nType", (short)SyntaxCheckMode.OFF);

                    TimerOnTick(null, null);
                }
            }
            catch (Exception ex)
            {
                MainApp.log.Error("Error in Stop_SyntaxCheck()", ex);
            }
        }
Esempio n. 5
0
        public FormOption(Form form)
        {
            parentForm = form;
            InitializeComponent();

            tclm = MainApp.GetDoc().GetTCLanguageManager();
        }
Esempio n. 6
0
        private void TimerOnTick(object sender, System.EventArgs e)
        {
            if (Enabled == false)
            {
                timer.Enabled = false;
                return;
            }

            try
            {
                if (adsServer != null && adsServer.PlcIsRunning)
                {
                    int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
                    string plcVar          = ".PLCMachineMode[" + selectedChannel.ToString() + "].SyntaxCheck";

                    object obj = adsPlc.ReadSymbol(plcVar + ".nType");
                    if (obj != null && ((short)obj == (short)SyntaxCheckMode.SyntaxCheck || (short)obj == (short)SyntaxCheckMode.DryRun))
                    {
                        lbActive.Visible = true;
                    }
                    else
                    {
                        lbActive.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MainApp.log.Error("Error in SyntaxCheck TimerOnTick()", ex);
            }
        }
Esempio n. 7
0
        public override void FKeyUpEvent(int nIdx)
        {
            int group = (nIdx - 1) + (pageNumber - 1) * 20;

            try
            {
                switch (nIdx)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                    //Page 1 - Group 1..11
                    //Page 2 - Group 21..31
                    tcAppPlcManual1.SetCurrentGroup(group);
                    groupSelected = nIdx;

                    break;

                case 12:
                    MainApp.GetDoc().tcFKey1.FKeySelectedMode = false;
                    parentForm.BringToFront();
                    break;
                }
            }
            catch
            { }
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSystemInfo"/> class.
        /// </summary>
        public FormSystemInfo()
        {
            adsNcServer  = MainApp.GetDoc().AdsNcServer;
            adsPlcServer = MainApp.GetDoc().AdsPlcServer;

            int languageId = 1031;

            if (MainApp.GetDoc().tcUserAdmin1.CurrentUser.Language != 0)
            {
                languageId = 1033;
            }
            frmSystemInfo.LanguageId = languageId;
            frmSystemInfo.Add(Assembly.GetExecutingAssembly().ManifestModule.Name, ApplicationVersion);
            frmSystemInfo.Add("TwinCAT.Ads.dll", typeof(TwinCAT.Ads.TcAdsClient));
            frmSystemInfo.Add("Beckhoff.Forms.dll", typeof(Beckhoff.Forms.TcAdsPlcServer));
            frmSystemInfo.Add("Beckhoff.Forms.Nc.dll", typeof(Beckhoff.Forms.Nc.TcAdsNcServer));
            frmSystemInfo.Add("Beckhoff.App.dll", typeof(Beckhoff.App.TcFKey));
            frmSystemInfo.Add("Beckhoff.EventLogger.dll", typeof(Beckhoff.EventLogger.TcLog4NetView));
            frmSystemInfo.Add("TcAppPlcManual.dll", typeof(TwinCAT.App.ManualFunctions.TcAppPlcManual));
            frmSystemInfo.Add("TwinCAT System.dll", TwinCATVersion);
            if (adsNcServer != null && adsNcServer.ClientPortNr == 553)
            {
                frmSystemInfo.Add("TwinCAT CNC", CNCVersion);
            }
            if (adsNcServer != null && adsNcServer.ClientPortNr == 501)
            {
                frmSystemInfo.Add("TwinCAT NCI", CNCVersion);
            }
            frmSystemInfo.Add("TwinCAT PLC Project", PlcProject);
        }
Esempio n. 9
0
        private void Start_SyntaxCheck()
        {
            try
            {
                if (adsServer != null && adsServer.PlcIsRunning)
                {
                    int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
                    string plcVar          = ".PLCMachineMode[" + selectedChannel.ToString() + "].SyntaxCheck";

                    // Syntax Check ON
                    if (rbSyntaxCheck.Checked)
                    {
                        adsPlc.WriteSymbol(plcVar + ".nType", (short)SyntaxCheckMode.SyntaxCheck);
                    }

                    // Dry Run On
                    if (rbDryRun.Checked)
                    {
                        adsPlc.WriteSymbol(plcVar + ".nType", (short)SyntaxCheckMode.DryRun);
                    }

                    TimerOnTick(null, null);
                }
            }
            catch (Exception ex)
            {
                MainApp.log.Error("Error in Start_SyntaxCheck()", ex);
            }
        }
Esempio n. 10
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (MainApp.GetDoc().ActiveMdiChild is TcApplication.FormMView &&
                adsPlcServer != null &&
                adsPlcServer.PlcIsRunning)
            {
                TwinCAT.Ads.AdsStream adsStream = new TwinCAT.Ads.AdsStream(500);
                BinaryReader          binRead   = new BinaryReader(adsStream);
                int res;

                try
                {
                    for (int i = 0; i < numberOfViews; i++)
                    {
                        adsStream.Position = 0;
                        res = adsPlcServer.PlcClient.Read(".MViewStatus[" + (i + 1) + "].Color", ref adsStream);
                        for (int field = 0; field < MViewBox[i].Fields; field++)
                        {
                            MViewBox[i].ValueBackColor(field, GetColor(binRead.ReadInt16()));
                        }

                        adsStream.Position = 0;
                        res = adsPlcServer.PlcClient.Read(".MViewStatus[" + (i + 1) + "].Description", ref adsStream);
                        for (int field = 0; field < MViewBox[i].Fields; field++)
                        {
                            MViewBox[i].Value(field, new string(binRead.ReadChars(31)));
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainApp.log.Error("Error in FormMView timer1_Tick()", ex);
                }
            }
        }
Esempio n. 11
0
        private void adsPlcServer_TcPlcStateChanged(TwinCAT.Ads.AdsState state)
        {
            if (state == TwinCAT.Ads.AdsState.Run)
            {
                // set the initial value for the feedrate override
                if (tcOverride1.PlcVarFeedOverride.Length != 0)
                {
                    SetPLCVar(tcOverride1.PlcVarFeedOverride, 100);
                    tcOverride1.FeedrateOverrideValue = 100;
                }
                if (tcOverride1.PlcVarSpindleOverride.Length != 0)
                {
                    SetPLCVar(tcOverride1.PlcVarSpindleOverride, 100);
                    tcOverride1.SpindleOverrideValue = 100;
                }

                tcFKeyLeft.FKeySelectedMode           = true;
                tcFKeyLeft.FKeyButtonObj(1).BackColor = MainApp.GetDoc().ColorCaption;                  // is the selected color
                selectedKeyPressChannel = 1;
                SelectChannel(1);

                // write startup ProgramName to the PLC
                int max = adsNcServer.NcClient.InterfaceData.NumberOfChannels;
                for (int i = 1; i <= max; i++)
                {
                    string plcString = ".PLCMachineMode[" + i.ToString() + "]";
                    SetPLCVar(plcString + ".ProgramName", MainApp.appSettings.programName[i]);
                }
            }
        }
Esempio n. 12
0
        private void rbStartBreakPoint_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (rbStartBreakPoint.Checked && adsServer != null && adsServer.PlcIsRunning)
                {
                    Stop_BlockSearch();
                    int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
                    object obj             = adsPlc.ReadSymbol(".CNCSystem.Channel[" + selectedChannel + "].ActBlockCount");
                    if (obj != null)
                    {
                        tbBreakPoint.Text = obj.ToString();
                    }
                    obj = adsPlc.ReadSymbol(".CNCSystem.Channel[" + selectedChannel + "].ActDistance");
                    if (obj != null)
                    {
                        tbDistance.Text = obj.ToString();
                    }

                    tbBreakPoint.Enabled    = true;
                    tbBlockCount.Enabled    = false;
                    tbBlockNr.Enabled       = false;
                    tbDistance.Enabled      = true;
                    btSetBreakPoint.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MainApp.log.Error("Error in rbStartBreakPoint_CheckedChanged()", ex);
            }
        }
Esempio n. 13
0
        private void Stop_BlockSearch()
        {
            if (Enabled == false)
            {
                return;
            }

            try
            {
                if (adsServer != null && adsServer.PlcIsRunning)
                {
                    int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
                    string plcVar          = ".PLCMachineMode[" + selectedChannel.ToString() + "].BlockSearch";

                    // Typ auf 0 setzen
                    adsPlc.WriteSymbol(plcVar + ".nType", (short)BlockSearchMode.OFF);

                    // Wert schreiben
                    adsPlc.WriteSymbol(plcVar + ".bStartWrite", "TRUE");

                    // Reset Flag Satzsuchlauf aktiv
                    adsPlc.WriteSymbol(plcVar + ".Active", "False");

                    TimerOnTick(null, null);
                }
            }
            catch (Exception ex)
            {
                MainApp.log.Error("Error in Stop_BlockSearch()", ex);
            }
        }
Esempio n. 14
0
        private void tcFKeyOpMode_FKeyUpEvent(int nIdx)
        {
            int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
            string plcString       = ".PLCMachineMode[" + selectedChannel.ToString() + "]";
            bool   res             = false;

            OpModeWindow.Close(1);
            // deactivated the selected axis, if the manual mode was previously selected
            ManualModeSelected(false);
            switch (nIdx)
            {
            case 1:                     // Automatic Mode
                res = SetPLCVar(plcString + ".Automatic", true);
                break;

            case 2:                                     // Manual Mode
                opModeManual1.SetManualModeAxisParam(); // set the default value
                res = SetPLCVar(plcString + ".Manual", true);
                break;

            case 3:                     // MDI Mode
                res = SetPLCVar(plcString + ".MDI", true);
                break;

            case 4:                     // Reference Mode
                res = SetPLCVar(plcString + ".Reference", true);
                break;
            }
            //if (res == true)
            //	SetFKeyOpModeStatus(nIdx);
        }
Esempio n. 15
0
        private void opModeAuto1_FileNameChanged(string strFileName)
        {
            int    selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
            string plcString       = ".PLCMachineMode[" + selectedChannel.ToString() + "]";

            SetPLCVar(plcString + ".ProgramName", opModeAuto1.selectFile1.Arguments);
        }
Esempio n. 16
0
        public Form8()
        {
            InitializeComponent();

            adsPlcServer = MainApp.GetDoc().AdsPlcServer;
            adsNcServer  = MainApp.GetDoc().AdsNcServer;
        }
Esempio n. 17
0
        private void SelectChannel(int channel)
        {
            int prevChannel = tcAxesList1.ChannelNumber;

            tcAxesList1.ChannelNumber     = channel;
            tcOverride1.ChannelNumber     = channel;
            tcSpeedControl1.ChannelNumber = channel;
            tcTechnoData1.ChannelNumber   = channel;
            opModeAuto1.tcNcProgramSection1.ChannelNumber = channel;

            // save the program name from the active channel and switch to the new one
            MainApp.appSettings.programName[prevChannel]   = opModeAuto1.selectFile1.Arguments;
            MainApp.appSettings.mdiCommand[prevChannel]    = opModeMDI1.MdiText;
            opModeAuto1.selectFile1.Arguments              = MainApp.appSettings.programName[channel];
            opModeAuto1.tcNcProgramSection1.CncProgramName = opModeAuto1.selectFile1.Arguments;
            opModeMDI1.MdiText = MainApp.appSettings.mdiCommand[channel];

            // ...also set to main form
            MainApp.GetDoc().AppHeader.ChannelNr = channel;
            MainApp.GetDoc().AppHeader.LabelChannelText = tclm["MainApp.labelChannelNr"];

            // ...also selection to the PLC
            SetPLCVar(".PLCSelectedChannel", channel);

            // ... and restore the display info
            NcClient_OpModeStateChanged(channel, -1, -1);
        }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FormMessages"/> class.
        /// </summary>
        /// <param name="form">The form.</param>
        public FormMessages(Form form)
        {
            parentForm = form;
            InitializeComponent();

            settings = MainApp.appSettings;
            string amsNetId = settings.amsNetId;

            if (!string.IsNullOrEmpty(amsNetId))
            {
                tcEventLoggerData1.Connection = Beckhoff.EventLogger.ConnectionType.Ads;
            }
            tcEventLoggerData1.AdsServerNetId = amsNetId;
            tclm = MainApp.GetDoc().GetTCLanguageManager();

            tcEventLoggerData1.EventChanged            += new Beckhoff.EventLogger.TcEventChangedEventHandler(tcEventLoggerData1_EventChanged);
            tcEventLoggerData1.InstructionEventChanged += new Beckhoff.EventLogger.TcEventChangedEventHandler(tcEventLoggerData1_InstructionEventChanged);
            tcEventLoggerData1.GetActiveEvents();
            labelEventLogStatus.Text = "Active Events";
            cBLanguage.SelectedIndex = settings.eventlogLanguage;

            tcLog4NetView1.FileName = Application.StartupPath + "\\program.log";

            tcEventLoggerList1.ColumnReordered     += new ColumnReorderedEventHandler(tcEventLoggerList1_ColumnReordered);
            tcEventLoggerList1.ColumnWidthChanging += new ColumnWidthChangingEventHandler(tcEventLoggerList1_ColumnWidthChanging);

            labelEventLogStatus.BackColor   = MainApp.GetDoc().ColorCaption;
            tcEventLoggerList1.CaptionColor = MainApp.GetDoc().ColorCaption;
            tcLog4NetView1.CaptionColor     = MainApp.GetDoc().ColorCaption;
            MainApp.GetDoc().tcUserAdmin1.CurrentUserChanged += new Beckhoff.App.Security.TcUserAdmin.CurrentUserChangedEventHandler(tcUserAdmin1_CurrentUserChanged);
        }
Esempio n. 19
0
        public FormMaschPara(Form form)
        {
            parentForm = form;
            InitializeComponent();

            // Language Manager
            tclm = MainApp.GetDoc().GetTCLanguageManager();
            tcMachineParam1.LanguageManager = tclm;
            tcMachineParam1.UserLevel       = MainApp.GetDoc().tcUserAdmin1.CurrentUserLevel;
            tcMachineParam1.ValidateValue  += new TcMachineParam.OnValidateValue(tcMachineParam1_ValidateValue);
            MainApp.GetDoc().tcUserAdmin1.CurrentUserChanged += new Beckhoff.App.Security.TcUserAdmin.CurrentUserChangedEventHandler(tcUserAdmin1_CurrentUserChanged);

            // error handler
            tcMachineParam1.Error += new TcMachineParam.MaschParErrorEventHandler(tcMachineParam1_Error);

            if (tcMachineParam1.Read(Application.StartupPath + "\\System\\MaschParam.ini") == false)
            {
                MainApp.log.Error("Machine parameter ini file could not be found! \\System\\MaschParam.ini");
            }

            adsPlcServer = MainApp.GetDoc().AdsPlcServer;
            if (adsPlcServer != null)
            {
                adsPlcServer.TcPlcStateChanged += new TcAdsStateChangedEventHandler(adsPlcServer_TcPlcStateChanged);
            }

            labelCaption.BackColor = MainApp.GetDoc().ColorCaption;
        }
Esempio n. 20
0
 private void timerActiveProgram_Tick(object sender, System.EventArgs e)
 {
     if (MainApp.GetDoc() != null)
     {
         int selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;
         labelBoxActiveProgram.Text = adsNcServer.NcClient.Channel[selectedChannel].FileName;
     }
 }
Esempio n. 21
0
 private void OPModeMDI_Load(object sender, EventArgs e)
 {
     if (MainApp.GetDoc() != null)
     {
         TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
         Font          newFont = (Font)tc.ConvertFromString(MainApp.appSettings.ncFontName);
         textBoxMDI.Font = newFont;
     }
 }
Esempio n. 22
0
        private void RestoreFunctionStatus(bool alwaysUpdate)
        {
            int    selectedChannel      = MainApp.GetDoc().AppHeader.ChannelNr;
            string plcString            = ".PLCMachineMode[" + selectedChannel.ToString() + "]";
            CncSpecialFunctions cncFunc = SpecialFunc;

            // Reads the status and restore after activation
            SpecialFunc.SingleBlockMode = false;
            SpecialFunc.M01Stop         = false;
            SpecialFunc.Retrace         = false;
            SpecialFunc.EnableHW        = false;
            SpecialFunc.SkipBlock       = false;

            try
            {
                if (adsPlcServer.PlcIsRunning == true)
                {
                    try
                    {
                        SpecialFunc.SingleBlockMode = (bool)adsPlcServer.PlcClient.ReadSymbol(plcString + ".SingleBlock");
                        SpecialFunc.M01Stop         = (bool)adsPlcServer.PlcClient.ReadSymbol(plcString + ".M01Stop");
                        SpecialFunc.Retrace         = (bool)adsPlcServer.PlcClient.ReadSymbol(plcString + ".Backward");
                        SpecialFunc.EnableHW        = (bool)adsPlcServer.PlcClient.ReadSymbol(".PLCAxisEnable");
                        SpecialFunc.SkipBlock       = (bool)adsPlcServer.PlcClient.ReadSymbol(plcString + ".PrgBlockIgnore");

                        if (adsNcServer.ClientPortNr == 553)
                        {
                            // Restore BlockSearch
                            object obj = adsPlcServer.PlcClient.ReadSymbol(plcString + ".BlockSearch.Active");
                            if (obj != null && (bool)obj)
                            {
                                tcFunctionView.SelectedIndex = 1;
                                blockSearch1.TimerEnabled    = true;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MainApp.log.Error("Error in FormCnc RestoreFunctionStatus()", ex);
                    }
                }
            }
            catch
            { }

            if (alwaysUpdate ||
                cncFunc.EnableHW != SpecialFunc.EnableHW ||
                cncFunc.M01Stop != SpecialFunc.M01Stop ||
                cncFunc.ManualModeRapidFeed != SpecialFunc.ManualModeRapidFeed ||
                cncFunc.Retrace != SpecialFunc.Retrace ||
                cncFunc.SingleBlockMode != SpecialFunc.SingleBlockMode ||
                cncFunc.SkipBlock != SpecialFunc.SkipBlock)
            {
                ShowIconStatus();
            }
        }
Esempio n. 23
0
        public FormMView(Form form)
        {
            parentForm = form;
            InitializeComponent();

            tclm         = MainApp.GetDoc().GetTCLanguageManager();
            adsPlcServer = MainApp.GetDoc().AdsPlcServer;

            initDone = true;
        }
Esempio n. 24
0
        private void tcEventLoggerData1_InstructionEventChanged(Beckhoff.EventLogger.TcEventItem eventItem, Beckhoff.EventLogger.TcEventType eventType)
        {
            if (eventItem == null)
            {
                return;
            }

            // route message to the main menu
            MainApp.GetDoc().MainAppMsgInfo(eventItem);
        }
Esempio n. 25
0
        private void FormCnc_Activated(object sender, System.EventArgs e)
        {
            // channel description on left side
            LoadLanguageKeysLeft();
            // special functions on right side
            LoadLanguageKeysRight();

            NcClient_OpModeStateChanged(MainApp.GetDoc().AppHeader.ChannelNr, -1, -1);
            TimerStatusUpdate.Enabled = true;
            tcTechnoData1.EnableTimer = true;
        }
Esempio n. 26
0
        private void tcFKeyLeft_FKeyUpEvent(int nIdx)
        {
            if (nIdx <= adsNcServer.NcClient.InterfaceData.NumberOfChannels)
            {
                panelChannelOverview.Visible = false;
                SelectChannel(nIdx);
                selectedKeyPressChannel = nIdx;
            }

            if (nIdx == 8)
            {
                int selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;

                if (selectedChannel == 1)
                {
                    tcAxesList2.BackColor = Color.White;
                }
                else
                {
                    tcAxesList2.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Control);
                }

                if (selectedChannel == 2)
                {
                    tcAxesList3.BackColor = Color.White;
                }
                else
                {
                    tcAxesList3.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Control);
                }

                if (selectedChannel == 3)
                {
                    tcAxesList4.BackColor = Color.White;
                }
                else
                {
                    tcAxesList4.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Control);
                }

                if (selectedChannel == 4)
                {
                    tcAxesList5.BackColor = Color.White;
                }
                else
                {
                    tcAxesList5.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Control);
                }

                panelChannelOverview.Visible = true;
                panelChannelOverview.BringToFront();
                selectedKeyPressChannel = nIdx;
            }
        }
Esempio n. 27
0
        void NcClient_OpModeStateChanged(int channel, int mode, int state)
        {
            int selectedChannel = MainApp.GetDoc().AppHeader.ChannelNr;

            if (MainApp.GetDoc().ActiveMdiChild is TcApplication.FormCnc &&
                selectedChannel == channel)
            {
                RestoreChannelStatus();
                RestoreFunctionStatus(true);
            }
        }
Esempio n. 28
0
        public FormSettings()
        {
            InitializeComponent();

            tclm     = MainApp.GetDoc().GetTCLanguageManager();
            settings = MainApp.appSettings;
            SetToScreen();
            labelTitle.BackColor = MainApp.GetDoc().ColorCaption;

            ncFontDialog        = new FontDialog();
            ncFontDialog.Apply += new EventHandler(ncFontDialog_Apply);
        }
Esempio n. 29
0
        private void SetFKeyOpModeStatus(int nIdx)
        {
            bool bAutomaticMode = false;
            bool bManualMode    = false;
            bool bMDIMode       = false;

            tcFKeyOpMode.FKeyBackColor(1, Beckhoff.App.TcColor.Gray);
            tcFKeyOpMode.FKeyBackColor(2, Beckhoff.App.TcColor.Gray);
            tcFKeyOpMode.FKeyBackColor(3, Beckhoff.App.TcColor.Gray);
            tcFKeyOpMode.FKeyBackColor(4, Beckhoff.App.TcColor.Gray);
            tcFKeyOpMode.FKeyBackColor(nIdx, MainApp.GetDoc().ColorCaption);

            Beckhoff.App.TcFKey fkey = MainApp.GetDoc().tcFKey1;
            fkey.FKeyText(1, "", null, Color.Empty);
            fkey.FKeyText(2, "", null, Color.Empty);
            fkey.FKeyText(3, "", null, Color.Empty);

            switch (nIdx)
            {
            case 1:                     // Automatic
                bAutomaticMode = true;
                break;

            case 2:                     // Manual
                fkey.FKeyText(1, "", Image.FromFile(Application.StartupPath + "\\Bitmap\\Key_M.ico"), Color.Yellow);
                fkey.FKeyText(2, "", Image.FromFile(Application.StartupPath + "\\Bitmap\\Eilgang.ico"));
                fkey.FKeyText(3, "", Image.FromFile(Application.StartupPath + "\\Bitmap\\Key_P.ico"), Color.Yellow);
                if (SpecialFunc.ManualModeRapidFeed)
                {
                    fkey.FKeyBackColor(2, Color.Orange);
                }
                else
                {
                    fkey.FKeyBackColor(2, Color.Yellow);
                }
                bManualMode = true;
                break;

            case 3:                     // MDI
                bMDIMode = true;
                break;

            case 4:                     // Reference
                break;
            }

            // selects the right screen
            ManualModeSelected(bManualMode);
            opModeAuto1.Visible   = bAutomaticMode;
            opModeManual1.Visible = bManualMode;
            opModeMDI1.Visible    = bMDIMode;
        }
Esempio n. 30
0
 public void Open(int frmHeight, Beckhoff.App.TcFKey tcFKey)
 {
     point_FKey.X    = 3 * MainApp.GetDoc().tcFKey1.FKeyButtonObj(1).Width;
     point_FKey.Y    = frmHeight;
     direction       = 1;
     endPoint_Y      = point_FKey.Y - tcFKey.Height - 0;
     tcFKey.Location = point_FKey;
     tcFKey.Visible  = true;
     tcFKey.BringToFront();
     wndHeight      = frmHeight;
     fKey           = tcFKey;
     timer1.Enabled = true;
 }