Пример #1
0
 void Initialize(ServerConnection connection, SrcpGenericLoc current)
 {
     this.current     = current;
     serverConnection = connection;
     selectBus.SetServer(serverConnection);
     if (current != null)
     {
         textBoxAddress.Text = current.Address.ToString();
         selectBus.Bus       = current.Bus;
         foreach (GlType type in comboBoxType.Items)
         {
             if (type.Protocol == current.Protocol)
             {
                 comboBoxType.SelectedItem = type;
                 break;
             }
         }
         comboBoxSteps.Text    = current.Steps.ToString();
         textBoxFunctions.Text = current.NumberOfFunctions.ToString();
     }
     else
     {
         selectBus.Bus = 1;
     }
 }
Пример #2
0
        public SrcpGenericLoc GetSrcpGenericLoc()
        {
            if (srcpGenericLoc == null)
            {
                Control control = null;
                try
                {
                    control = selectBus;
                    int bus = selectBus.Bus;

                    control = textBoxAddress;
                    int address = int.Parse(textBoxAddress.Text);

                    control = comboBoxType;
                    GlType type = (GlType)comboBoxType.SelectedItem;

                    control = comboBoxSteps;
                    int steps = int.Parse(comboBoxSteps.Text);

                    control = textBoxFunctions;
                    int functions = int.Parse(textBoxFunctions.Text);

                    control = null;

                    if (current == null)
                    {
                        current = new SrcpGenericLoc(serverConnection);
                    }
                    current.Init(bus, address, type.Protocol, steps, functions);
                    srcpGenericLoc = current;
                }
                catch
                {
                    if (control != null)
                    {
                        control.Focus();
                    }
                    throw;
                }
            }
            return(srcpGenericLoc);
        }
Пример #3
0
 public void Initialize(SrcpGenericLoc current)
 {
     Initialize(current.Connection, current);
 }
Пример #4
0
 public NewAndUpdateGenericLoc(SrcpGenericLoc current) : this()
 {
     Initialize(current);
 }