/// <summary>
 /// Handles the Click event of the butAddLocator control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void butAddLocator_Click(object sender, EventArgs e)
 {
     try
     {
         ConfigureLocatorForm configureLocatorForm = new ConfigureLocatorForm();
         List <string>        names = new List <string>();
         foreach (OnlineLocator loc in _Locators)
         {
             names.Add(loc.Name);
         }
         configureLocatorForm.LocatorNamesAlreadyInUse = names;
         if (configureLocatorForm.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 OnlineLocator         newloc = configureLocatorForm.ConfiguredLocator;
                 LocatorHub.LocatorHub client = LocatorManager.CreateClient(newloc);
                 LocatorCapabilities   locatorCapabilities = client.Capabilities(newloc.GazId);
                 newloc.Target = locatorCapabilities.TargetElements[0].TargetElementIdentity;
                 _Locators.Add(newloc);
                 lstLocators.Refresh();
                 lstLocators.SelectedItem = newloc;
                 lstLocators.Refresh();
                 this.lstLocators_SelectedIndexChanged(this, null);
             }
             catch (Exception)
             {
             }
         }
     }
     catch (Exception exv)
     {
         DataHubExtension.ShowError(exv);
     }
 }
        /// <summary>
        /// Handles the SelectedIndexChanged event of the lstLocators control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void lstLocators_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (lstLocators.SelectedItem != null)
                {
                    OnlineLocator         current = lstLocators.SelectedItem as OnlineLocator;
                    LocatorHub.LocatorHub client  = LocatorManager.CreateClient(current);

                    LocatorCapabilities locatorCapabilities = client.Capabilities(current.GazId);

                    List <Target> targets = new List <Target>();
                    foreach (TargetElementDefinition targetElementDefinition in locatorCapabilities.TargetElements)
                    {
                        targets.Add(new Target(targetElementDefinition.TargetElementIdentity, targetElementDefinition.TargetElementName));
                    }

                    this._Targets = targets;

                    cboTarget.DisplayMember   = "Description";
                    cboTarget.ValueMember     = "Id";
                    this.cboTarget.DataSource = _Targets;
                    cboTarget.SelectedValue   = _Targets[0].Id;
                    cboTarget.Refresh();


                    ConfigureUI();
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Re-connects to remote service.
        /// </summary>
        /// <param name="inLocatorDefinition">The in locator definition.</param>
        private void ReConnectToRemoteService(OnlineLocator inLocatorDefinition)
        {
            cboUrl.Text      = inLocatorDefinition.Url;
            txtUsername.Text = inLocatorDefinition.Username;
            txtPassword.Text = inLocatorDefinition.Password;
            switch (inLocatorDefinition.Authentication)
            {
            case AuthenticationMode.CurrentWindows:
                radAuthWindows.Checked          = true;
                chkUseCurrentCredntials.Checked = true;
                break;

            case AuthenticationMode.Token:
                radAuthToken.Checked = true;
                break;

            case AuthenticationMode.Windows:
                radAuthWindows.Checked          = true;
                chkUseCurrentCredntials.Checked = false;
                break;

            default:
                radAuthNone.Checked = true;
                break;
            }
            ConnectToHub();
            cboLocator.SelectedValue = inLocatorDefinition.GazId;
            if (cboLocator.SelectedItem != null)
            {
                lblDesc.Text = ((RemoteLocator)cboLocator.SelectedItem).LocatorDescription;
            }
        }
 public ConfigureFieldListForm(OnlineLocator inLocator)
     : this()
 {
     this.locator = inLocator;
     this.locatorNameLabel.Text = inLocator.Name;
     GetAllFields();
     PopulateListBoxes();
     EnableButtons();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Re-connects to online service.
 /// </summary>
 /// <param name="inLocatorDefinition">The in locator definition.</param>
 private void ReConnectToOnlineService(OnlineLocator inLocatorDefinition)
 {
     foreach (OnlineLocator l in _DHubLocators)
     {
         if (l.GazId == inLocatorDefinition.GazId)
         {
             if (("DATAHUB:" + l.Url).Equals(inLocatorDefinition.Url, StringComparison.InvariantCultureIgnoreCase))
             {
                 cboDhubLocator.SelectedValue = l.Id;
                 break;
             }
         }
     }
 }
 /// <summary>
 /// Handles the Click event of the butMoveLocatorDown control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void butMoveLocatorDown_Click(object sender, EventArgs e)
 {
     try
     {
         int           currentindex  = lstLocators.SelectedIndex;
         OnlineLocator onlineLocator = _Locators[currentindex];
         _Locators.RemoveAt(currentindex);
         _Locators.Insert(currentindex + 1, onlineLocator);
         _Locators.ResetBindings();
         lstLocators.Refresh();
         lstLocators.SelectedIndex = currentindex + 1;
     }
     catch (Exception ex)
     {
         DataHubExtension.ShowError(ex);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureLocatorForm"/> class.
 /// </summary>
 /// <param name="onlineLocator">The online locator.</param>
 public ConfigureLocatorForm(OnlineLocator onlineLocator)
     : this()
 {
     // Now, if re-bining to an existing. Select the appropriate one
     if (onlineLocator != null)
     {
         _ID = onlineLocator.GazId;
         txtName.Text = onlineLocator.Name;
         if (onlineLocator.Url.StartsWith("DATAHUB:", StringComparison.CurrentCultureIgnoreCase))
         {
             radOnline.Checked = true;
             ReConnectToOnlineService(onlineLocator);
         }
         else
         {
             ReConnectToRemoteService(onlineLocator);
             radHubConnection.Checked = true;
         }
         ConfigureUI();
        }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureLocatorForm"/> class.
 /// </summary>
 /// <param name="onlineLocator">The online locator.</param>
 public ConfigureLocatorForm(OnlineLocator onlineLocator)
     : this()
 {
     // Now, if re-bining to an existing. Select the appropriate one
     if (onlineLocator != null)
     {
         _ID          = onlineLocator.GazId;
         txtName.Text = onlineLocator.Name;
         if (onlineLocator.Url.StartsWith("DATAHUB:", StringComparison.CurrentCultureIgnoreCase))
         {
             radOnline.Checked = true;
             ReConnectToOnlineService(onlineLocator);
         }
         else
         {
             ReConnectToRemoteService(onlineLocator);
             radHubConnection.Checked = true;
         }
         ConfigureUI();
     }
 }
 /// <summary>
 /// Handles the SelectedIndexChanged event of the cboTarget control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void cboTarget_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (lstLocators.SelectedItem == null)
         {
             return;
         }
         if (cboTarget.SelectedItem == null)
         {
             return;
         }
         OnlineLocator onlineLocator = lstLocators.SelectedItem as OnlineLocator;
         Target        target        = cboTarget.SelectedItem as Target;
         onlineLocator.Target = target.Id;
         ConfigureUI();
     }
     catch (Exception ex)
     {
         DataHubExtension.ShowError(ex);
     }
 }
        /// <summary>
        /// Handles the Click event of the butEditLocatorDefinition control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void butEditLocatorDefinition_Click(object sender, EventArgs e)
        {
            try
            {
                if (lstLocators.SelectedItem == null)
                {
                    return;
                }

                OnlineLocator currentItem = lstLocators.SelectedItem as OnlineLocator;
                if (currentItem == null)
                {
                    return;
                }

                ConfigureLocatorForm configureLocatorForm = new ConfigureLocatorForm(currentItem);
                List <string>        names = new List <string>();
                foreach (OnlineLocator loc in _Locators)
                {
                    names.Add(loc.Name);
                }

                names.Remove(currentItem.Name);
                configureLocatorForm.LocatorNamesAlreadyInUse = names;
                if (configureLocatorForm.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        //remove old item from the list
                        _Locators.Remove(lstLocators.SelectedItem as OnlineLocator);
                        //pickup the new item from the dialog and try to add to the list
                        OnlineLocator         newloc = configureLocatorForm.ConfiguredLocator;
                        LocatorHub.LocatorHub client = LocatorManager.CreateClient(newloc);
                        LocatorCapabilities   locatorCapabilities = client.Capabilities(newloc.GazId);
                        newloc.Target = locatorCapabilities.TargetElements[0].TargetElementIdentity;
                        _Locators.Add(newloc);
                        lstLocators.Refresh();
                        lstLocators.SelectedItem = newloc;
                        lstLocators.Refresh();
                        this.lstLocators_SelectedIndexChanged(this, null);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception exv)
            {
                DataHubExtension.ShowError(exv);
            }

            try
            {
                //using (ConfigureLocatorDialog cd = new ConfigureLocatorDialog())
                //{
                //    LocatorConfig loc = (LocatorConfig)lstLocators.SelectedItem;
                //    List<string> names = new List<string>();
                //    foreach (LocatorConfig tloc in _Locators)
                //    {
                //        names.Add(tloc.Name);
                //    }
                //    names.Remove(loc.Name);
                //    cd.ConfiguredLocator = loc;
                //    cd.LocatorNamesAlreadyInUse = names;
                //    if (cd.ShowDialog() == DialogResult.OK)
                //    {
                //        try
                //        {
                //            _Locators.ResetBindings();
                //            lstLocators.Refresh();
                //        }
                //        finally
                //        {

                //        }

                //    }
                //}
            }
            catch (Exception ex)
            {
                DataHubExtension.ShowError(ex);
            }
        }
 /// <summary>
 /// Re-connects to remote service.
 /// </summary>
 /// <param name="inLocatorDefinition">The in locator definition.</param>
 private void ReConnectToRemoteService(OnlineLocator inLocatorDefinition)
 {
     cboUrl.Text = inLocatorDefinition.Url;
     txtUsername.Text = inLocatorDefinition.Username;
     txtPassword.Text = inLocatorDefinition.Password;
     switch (inLocatorDefinition.Authentication)
     {
         case AuthenticationMode.CurrentWindows:
             radAuthWindows.Checked = true;
             chkUseCurrentCredntials.Checked = true;
             break;
         case AuthenticationMode.Token:
             radAuthToken.Checked = true;
             break;
         case AuthenticationMode.Windows:
             radAuthWindows.Checked = true;
             chkUseCurrentCredntials.Checked = false;
             break;
         default:
             radAuthNone.Checked = true;
             break;
     }
     ConnectToHub();
     cboLocator.SelectedValue = inLocatorDefinition.GazId;
     if (cboLocator.SelectedItem != null)
     {
         lblDesc.Text = ((RemoteLocator)cboLocator.SelectedItem).LocatorDescription;
     }
 }
 /// <summary>
 /// Re-connects to online service.
 /// </summary>
 /// <param name="inLocatorDefinition">The in locator definition.</param>
 private void ReConnectToOnlineService(OnlineLocator inLocatorDefinition)
 {
     foreach (OnlineLocator l in _DHubLocators)
     {
         if (l.GazId == inLocatorDefinition.GazId)
         {
             if (("DATAHUB:" + l.Url).Equals(inLocatorDefinition.Url, StringComparison.InvariantCultureIgnoreCase))
             {
                 cboDhubLocator.SelectedValue = l.Id;
                 break;
             }
         }
     }
 }