/// <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)
            {
            }
        }
 /// <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);
     }
 }
예제 #3
0
        /// <summary>
        /// Gets the list of locators from hub.
        /// </summary>
        /// <returns></returns>
        private BindingList <RemoteLocator> GetListOfLocatorsFromHub()
        {
            string             url            = cboUrl.Text;
            string             username       = null;
            string             password       = null;
            AuthenticationMode authentication = AuthenticationMode.None;

            if (radAuthWindows.Checked)
            {
                if (chkUseCurrentCredntials.Checked)
                {
                    authentication = AuthenticationMode.CurrentWindows;
                }
                else
                {
                    authentication = AuthenticationMode.Windows;
                    username       = txtUsername.Text;
                    password       = txtPassword.Text;
                }
            }
            else if (radAuthToken.Checked)
            {
                authentication = AuthenticationMode.Token;
                username       = txtUsername.Text;
                password       = txtPassword.Text;
            }


            LocatorHub.LocatorHub locatorHubClient = LocatorManager.CreateClient(url, username, password, authentication, null);

            return(new BindingList <RemoteLocator>(locatorHubClient.ListLocators()));
        }
예제 #4
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #5
0
        /// <summary>
        ///     Create an instance of AnnotationDocumentPaginator for a given document and annotation store.
        /// </summary>
        /// <param name="originalPaginator">document to add annotations to</param>
        /// <param name="annotationStore">store to retrieve annotations from</param>
        /// <param name="flowDirection"></param>
        public AnnotationDocumentPaginator(DocumentPaginator originalPaginator, AnnotationStore annotationStore, FlowDirection flowDirection)
        {
            _isFixedContent = originalPaginator is FixedDocumentPaginator || originalPaginator is FixedDocumentSequencePaginator;

            if (!_isFixedContent && !(originalPaginator is FlowDocumentPaginator))
            {
                throw new ArgumentException(SR.Get(SRID.OnlyFlowAndFixedSupported));
            }

            _originalPaginator = originalPaginator;
            _annotationStore   = annotationStore;
            _locatorManager    = new LocatorManager(_annotationStore);
            _flowDirection     = flowDirection;

            // Register for events
            _originalPaginator.GetPageCompleted          += new GetPageCompletedEventHandler(HandleGetPageCompleted);
            _originalPaginator.ComputePageCountCompleted += new AsyncCompletedEventHandler(HandleComputePageCountCompleted);
            _originalPaginator.PagesChanged += new PagesChangedEventHandler(HandlePagesChanged);
        }
        /// <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);
            }
        }