Esempio n. 1
0
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index != 3)
     {
         throw new IndexOutOfRangeException("index");
     }
 }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            switch (arg.Index)
            {
            case 2:
                PaymentModeCb.Enabled = AccountStatusCb.Enabled = enabled;
                break;

            case 9:
                CreditReferenceAdd.Enabled = CreditReferenceEdit.Enabled = CreditReferenceRemove.Enabled = enabled;
                break;

            case 10:
                ChargeReferenceAdd.Enabled = ChargeReferenceEdit.Enabled = ChargeReferenceRemove.Enabled = enabled;
                break;

            case 11:
                CreditChargeAdd.Enabled = CreditChargeEdit.Enabled = CreditChargeRemove.Enabled = enabled;
                break;

            case 12:
                TokenGatewayAdd.Enabled = TokenGatewayEdit.Enabled = TokenGatewayRemove.Enabled = enabled;
                break;

            case 15:
                CurrencyNameTb.ReadOnly = CurrencyScaleTb.ReadOnly = !enabled;
                CurrencyUnitTb.Enabled  = enabled;
                break;

            default:
                throw new IndexOutOfRangeException("index");
            }
        }
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            GXDLMSAutoConnect target = Target as GXDLMSAutoConnect;

            if (arg.Index == 5)
            {
                CallingWindowLV.Items.Clear();
                foreach (var it in target.CallingWindow)
                {
                    ListViewItem li = CallingWindowLV.Items.Add(it.Key.ToFormatString());
                    li.SubItems.Add(it.Value.ToFormatString());
                    li.Tag = it;
                }
            }
            else if (arg.Index == 6)
            {
                DestinationLv.Items.Clear();
                if (target.Destinations != null)
                {
                    foreach (string it in target.Destinations)
                    {
                        DestinationLv.Items.Add(it);
                    }
                }
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }
Esempio n. 4
0
 public void OnMethodAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 1)
     {
         PushBtn.Enabled = arg.Connected && arg.Client.CanInvoke(Target, arg.Index);
     }
 }
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 10)
     {
         AddBtn.Enabled = EditBtn.Enabled = RemoveBtn.Enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
     }
 }
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         OutputStateCB.Enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
     }
 }
Esempio n. 7
0
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            GXDLMSMBusSlavePortSetup target = Target as GXDLMSMBusSlavePortSetup;

            /*
             * if (attributeID == 4)
             * {
             *
             *  CPrecedenceTB.Text = target.DefaultQualityOfService.Precedence.ToString();
             *  CDelayTB.Text = target.DefaultQualityOfService.Delay.ToString();
             *  CReliabilityTB.Text = target.DefaultQualityOfService.Reliability.ToString();
             *  CPeakThroughputTB.Text = target.DefaultQualityOfService.PeakThroughput.ToString();
             *  CMeanThroughputTB.Text = target.DefaultQualityOfService.MeanThroughput.ToString();
             *  MPrecedenceTB.Text = target.RequestedQualityOfService.Precedence.ToString();
             *  MDelayTB.Text = target.RequestedQualityOfService.Delay.ToString();
             *  MReliabilityTB.Text = target.RequestedQualityOfService.Reliability.ToString();
             *  MPeakThroughputTB.Text = target.RequestedQualityOfService.PeakThroughput.ToString();
             *  MMeanThroughputTB.Text = target.RequestedQualityOfService.MeanThroughput.ToString();
             * }
             * else
             * {
             *  throw new IndexOutOfRangeException("attributeID");
             * }
             * */
        }
Esempio n. 8
0
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            GXDLMSParameterMonitor target = Target as GXDLMSParameterMonitor;

            if (arg.Index == 2)
            {
                if (target.ChangedParameter != null && target.ChangedParameter.Target != null)
                {
                    TargetTb.Text = target.ChangedParameter.Target.ToString();
                    IndexTb.Text  = target.ChangedParameter.AttributeIndex.ToString();
                    ValueTb.Text  = Convert.ToString(GXHelpers.ConvertFromDLMS(target.ChangedParameter.Value, DataType.None, DataType.None, true, false));
                }
                else
                {
                    TargetTb.Text = "";
                    IndexTb.Text  = "";
                    ValueTb.Text  = "";
                }
            }
            else if (arg.Index == 4)
            {
                ParametersLV.Items.Clear();
                if (target.Parameters != null)
                {
                    foreach (GXDLMSTarget it in target.Parameters)
                    {
                        ListViewItem li = ParametersLV.Items.Add(it.Target.ToString());
                        li.SubItems.Add(it.AttributeIndex.ToString());
                        li.Tag = it;
                    }
                }
            }
        }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 2)
            {
                MonitoredValueTB.Enabled  = enabled;
                MonitoredIndexTB.ReadOnly = !enabled;
            }
            else if (arg.Index == 8)
            {
                DurationTb.ReadOnly = ActivationTimeTb.ReadOnly = IdTb.ReadOnly = !enabled;
            }
            else if (arg.Index == 9)
            {
                EmergencyProfileGroupIDsTB.ReadOnly = !enabled;
            }
            else if (arg.Index == 10)
            {
                EmergencyProfileActiveCB.Enabled = enabled;
            }
            else if (arg.Index == 11)
            {
                ActionOverScript.Enabled             = ActionUnderScript.Enabled = ActionOverScript.Enabled = enabled;
                ActionUnderThresholdIndexTB.ReadOnly = ActionOverThresholdIndexTB.ReadOnly = !enabled;
            }
        }
Esempio n. 10
0
 public void OnMethodAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 7)
     {
         SecretTB.ReadOnly     = !(arg.Connected && arg.Client.CanInvoke(Target, arg.Index));
         SecretAsciiCb.Enabled = !SecretTB.ReadOnly;
     }
 }
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     //Attribute 5 is not used.
     if (arg.Index != 5)
     {
         throw new IndexOutOfRangeException("index");
     }
 }
Esempio n. 12
0
 public void OnValueChanged(GXDLMSViewArguments arg)
 {
     if (arg.Index == 3)
     {
     }
     else
     {
         throw new IndexOutOfRangeException("index");
     }
 }
Esempio n. 13
0
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 3)
            {
                addToolStripMenuItem.Enabled = editToolStripMenuItem.Enabled = removeToolStripMenuItem.Enabled =
                    ColumnAddBtn.Enabled     = ColumnEditBtn.Enabled = ColumnRemoveBtn.Enabled = enabled;
            }
        }
Esempio n. 14
0
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 8)
     {
         UseDhcpCp.Enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
     }
     else
     {
         throw new IndexOutOfRangeException("index");
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Update selected values of given COSEM object.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="view"></param>
        public static void UpdateProperty(GXDLMSClient client, GXDLMSObject obj, int index, IGXDLMSView view, bool connected, bool user)
        {
            if (obj == null)
            {
                return;
            }
            if ((view as Form).InvokeRequired)
            {
                try
                {
                    (view as Form).BeginInvoke(new UpdatePropertyEventHandler(UpdateProperty), client, obj, index, view, connected, user);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(view as Form, ex.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
                return;
            }
            GXDLMSObject tmp = view.Target;

            view.Description = tmp.Description;
            //If we want to show what properties are changed.
            if (view.ErrorProvider != null)
            {
                view.ErrorProvider.Clear();
                foreach (int it in tmp.GetDirtyAttributeIndexes())
                {
                    UpdateDirty(view, ((Form)view).Controls, tmp, it, true);
                }
            }
            //Update atribute values.
            for (int it = 1; it != (obj as IGXDLMSBase).GetAttributeCount() + 1; ++it)
            {
                if (index == 0 || it == index)
                {
                    object value = null;
                    bool   dirty = view.Target.GetDirty(it, out value);
                    value = view.Target.GetValues()[it - 1];
                    GXValueField item = UpdateProperty(view, ((Form)view).Controls, it, value);
                    if (item == null || item.NotifyChanges)
                    {
                        GXDLMSViewArguments arg = new GXDLMSViewArguments()
                        {
                            Client = client, Index = it, Connected = connected, User = user, Value = value
                        };
                        view.OnValueChanged(arg);
                    }
                    if (it == index)
                    {
                        break;
                    }
                }
            }
        }
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
         SystemTitleTB.ReadOnly = MACAddressTB.ReadOnly = LSAPSelectorTB.ReadOnly = !enabled;
     }
     else
     {
         throw new IndexOutOfRangeException("index");
     }
 }
 public void OnValueChanged(GXDLMSViewArguments arg)
 {
     if (arg.Index == 3)
     {
         ScalerTB.Text       = ((GXDLMSRegister)Target).Scaler.ToString();
         UnitTB.SelectedItem = ((GXDLMSRegister)Target).Unit;
     }
     else
     {
         throw new IndexOutOfRangeException("index");
     }
 }
Esempio n. 18
0
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            if (arg.Index == 2)
            {
                ObjectsLV.Items.Clear();
                foreach (var it in ((GXDLMSPushSetup)Target).PushObjectList)
                {
                    ListViewItem li = new ListViewItem(it.Key.ObjectType.ToString());
                    li.SubItems.Add(it.Key.LogicalName);
                    li.SubItems.Add(it.Value.AttributeIndex.ToString());
                    li.SubItems.Add(it.Value.DataIndex.ToString());
                    ObjectsLV.Items.Add(li);
                    li.Tag = it;
                }
            }
            else if (arg.Index == 3)
            {
                ServiceCB.SelectedIndexChanged -= new System.EventHandler(this.ServiceCB_SelectedIndexChanged);
                ServiceCB.SelectedItem          = ((GXDLMSPushSetup)Target).Service;
                ServiceCB.SelectedIndexChanged += new System.EventHandler(this.ServiceCB_SelectedIndexChanged);

                DestinationTB.TextChanged      -= new System.EventHandler(this.DestinationTB_TextChanged);
                DestinationTB.Text              = ((GXDLMSPushSetup)Target).Destination;
                DestinationTB.TextChanged      += new System.EventHandler(this.DestinationTB_TextChanged);
                MessageCB.SelectedIndexChanged -= new System.EventHandler(this.MessageCB_SelectedIndexChanged);
                MessageCB.SelectedItem          = ((GXDLMSPushSetup)Target).Message;
                MessageCB.SelectedIndexChanged += new System.EventHandler(this.MessageCB_SelectedIndexChanged);
            }
            else if (arg.Index == 4)
            {
                CommunicationWindowLV.Items.Clear();
                foreach (KeyValuePair <GXDateTime, GXDateTime> it in ((GXDLMSPushSetup)Target).CommunicationWindow)
                {
                    ListViewItem li;
                    if (GXDlmsUi.UseMeterTimeZone)
                    {
                        li = new ListViewItem(it.Key.ToFormatMeterString());
                        li.SubItems.Add(it.Value.ToFormatMeterString());
                    }
                    else
                    {
                        li = new ListViewItem(it.Key.ToFormatString());
                        li.SubItems.Add(it.Value.ToFormatString());
                    }
                    CommunicationWindowLV.Items.Add(li);
                    li.Tag = it;
                }
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            GXDLMSImageTransfer target = Target as GXDLMSImageTransfer;

            if (arg.Index == 3)
            {
                ImageTransferredBlocksStatusTB.Text = (string)arg.Value;
            }
            else if (arg.Index == 5)
            {
                ImageTransferEnabledCB.CheckedChanged -= new System.EventHandler(ImageTransferEnabledCB_CheckedChanged);
                ImageTransferEnabledCB.Checked         = target.ImageTransferEnabled;
                ImageTransferEnabledCB.CheckedChanged += new System.EventHandler(ImageTransferEnabledCB_CheckedChanged);
            }
            else if (arg.Index == 6)
            {
                ImageTransferStatusTb.Text = target.ImageTransferStatus.ToString();
                ManualBtn_CheckedChanged(null, null);
            }
            else if (arg.Index == 7)
            {
                ImagesView.Items.Clear();
                if (target.ImageActivateInfo != null)
                {
                    foreach (GXDLMSImageActivateInfo it in target.ImageActivateInfo)
                    {
                        ListViewItem li = ImagesView.Items.Add(it.Size.ToString());
                        if (GXByteBuffer.IsAsciiString(it.Identification))
                        {
                            li.SubItems.Add(ASCIIEncoding.ASCII.GetString(it.Identification));
                        }
                        else
                        {
                            li.SubItems.Add(GXDLMSTranslator.ToHex(it.Identification));
                        }
                        if (GXByteBuffer.IsAsciiString(it.Signature))
                        {
                            li.SubItems.Add(ASCIIEncoding.ASCII.GetString(it.Signature));
                        }
                        else
                        {
                            li.SubItems.Add(GXDLMSTranslator.ToHex(it.Signature));
                        }
                        li.Tag = it;
                    }
                }
            }
            else if (arg.Index != 0)
            {
                throw new IndexOutOfRangeException("index");
            }
        }
Esempio n. 20
0
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         bool writable = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
         ValuesLb.Enabled    = writable;
         DurationTb.ReadOnly = !writable;
     }
     else
     {
         throw new IndexOutOfRangeException("index");
     }
 }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 5)
            {
                TimeAddBtn.Enabled = TimeEditBtn.Enabled = TimeRemoveBtn.Enabled = enabled;
            }
            else if (arg.Index == 6)
            {
                DestinationAddBtn.Enabled = DestinationEditBtn.Enabled = DestinationRemoveBtn.Enabled = enabled;
            }
        }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            switch (arg.Index)
            {
            case 2:
            case 3:
            case 4:
            case 5:
                break;

            default:
                throw new IndexOutOfRangeException("index");
            }
        }
Esempio n. 23
0
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         SecurityPolicyTB.Enabled = !(!arg.Connected || !arg.Client.CanWrite(Target, 1));
     }
     else if (arg.Index == 5)
     {
     }
     else if (arg.Index != 6)
     {
         throw new IndexOutOfRangeException("index");
     }
 }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 3)
            {
                UnitTB.Enabled    = enabled;
                ScalerTB.ReadOnly = !enabled;
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }
Esempio n. 25
0
 public void OnAccessRightsChange(GXDLMSViewArguments arg)
 {
     bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);
     if (arg.Index == 2)
     {
         // register_assignment
         Assigments.Enabled = enabled;
     }
     else if (arg.Index == 3)
     {
         // mask_list
         Masks.Enabled = enabled;
     }
 }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 2)
            {
                addToolStripMenuItem.Enabled = editToolStripMenuItem.Enabled = removeToolStripMenuItem.Enabled =
                    AddBtn.Enabled           = EditBtn.Enabled = RemoveBtn.Enabled = enabled;
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }
        public void OnValueChanged(GXDLMSViewArguments arg)
        {
            if (arg.Index != 2)
            {
                throw new IndexOutOfRangeException("index");
            }
            EntriesView.Items.Clear();
            GXDLMSSchedule target = (GXDLMSSchedule)Target;

            foreach (GXScheduleEntry item in target.Entries)
            {
                AddEntry(item);
            }
        }
 public void OnValueChanged(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         GXDLMSSFSKActiveInitiator target = Target as GXDLMSSFSKActiveInitiator;
         SystemTitleTB.Text  = GXDLMSTranslator.ToHex(target.SystemTitle);
         MACAddressTB.Text   = target.MacAddress.ToString();
         LSAPSelectorTB.Text = target.LSapSelector.ToString();
     }
     else if (arg.Index != 0)
     {
         throw new IndexOutOfRangeException("index");
     }
 }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enable = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 6)
            {
                MccTb.ReadOnly            = MncTb.ReadOnly = ChannelNumberTb.ReadOnly = CellIDTb.ReadOnly =
                    LocationIDTb.ReadOnly = SignalQualityTb.ReadOnly = BerTb.ReadOnly = !enable;
            }
            else if (arg.Index == 7)
            {
                AdjacentCellsLV.Enabled = enable;
            }
        }
        public void OnAccessRightsChange(GXDLMSViewArguments arg)
        {
            bool enabled = arg.Connected && arg.Client.CanWrite(Target, arg.Index);

            if (arg.Index == 2)
            {
                ScriptSelectorTB.ReadOnly = !enabled;
                ScriptNameTB.Enabled      = enabled;
            }
            else if (arg.Index == 4)
            {
                TimeAddBtn.Enabled = TimeEditBtn.Enabled = TimeRemoveBtn.Enabled = Time.Enabled = enabled;
            }
        }