private void BlockList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            string nm = BlockList.SelectedItem.ToString();

            if (dispatcherTimer != null)
            {
                dispatcherTimer.Stop();
            }
            if (myDiag != null)
            {
                myDiag.Close();
                myDiag = null;
            }
            myBlock = MC7Converter.GetAWLBlock(_myconn.PLCGetBlockInMC7(nm), 0, myblkFld);
            if (myBlock != null)
            {
                if (myBlock.BlockType == PLCBlockType.DB)
                {
                    toppanel.ClearValue(HeightProperty);
                    toppanel.ClearValue(DockPanel.DockProperty);
                    textEditor.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    toppanel.Height = 160;
                    toppanel.SetValue(DockPanel.DockProperty, Dock.Top);
                    textEditor.Visibility = System.Windows.Visibility.Visible;
                }
                textEditor.Text    = myBlock.ToString();
                blockName.Content  = nm;
                Upload.IsEnabled   = true;
                Optimize.IsEnabled = true;
                Diag.IsEnabled     = true;

                if (myBlock.BlockType == PLCBlockType.DB)
                {
                    myTree.DataContext = ((S7DataBlock)myBlock).Structure.Children;
                }
                else
                {
                    myTree.DataContext = ((S7FunctionBlock)myBlock).Parameter.Children;
                }
            }
        }
 private void Upload_Click(object sender, RoutedEventArgs e)
 {
     byte[] val = MC7Converter.GetMC7Block(myBlock);
 }
Exemplo n.º 3
0
 public Block GetBlock(string BlockName)
 {
     byte[] tmp = Connection.PLCGetBlockInMC7(BlockName);
     return(MC7Converter.GetAWLBlock(tmp, Project != null ? (int)Project.ProjectLanguage : 0, Parent as S7ProgrammFolder));
 }