Beispiel #1
0
 public MainViewModel()
 {
     CurrentMessage   = string.Empty;
     FilterDateFinish = DateTime.Now;
     FilterDateStart  = DateTime.Now;
     Messages         = ServerDataProvider.GetMessages(Settings.AdressServer);
 }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 public void Disconnect()
 {
     try
     {
         if (HasAuthenticated)
         {
             m_innerHandler.Credentials.SignOut(Uri, null, null);
         }
     }
     finally
     {
         ServerDataProvider.DisconnectAsync().SyncResult();
     }
 }
        /// <summary>
        /// strat the server
        /// </summary>
        /// <param name="url">url of services</param>
        public void Start(string url)
        {
            if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
            {
                throw new Exception("url is not valid");
            }
            else if (uri.Port <= 0)
            {
                throw new Exception("port is not valid");
            }
            if (string.IsNullOrEmpty(uri.AbsolutePath))
            {
                throw new Exception("this path is not support,please set full path example: http://localhost:5050/SignalGo");
            }

            ServerDataProvider.Start(this, uri.Port);
        }
Beispiel #4
0
        public Task ConnectAsync(
            VssConnectMode connectMode,
            IDictionary <String, String> parameters,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            CheckForDisposed();
            // Set the connectMode on the credential's FederatedPrompt
            if (Credentials.Federated != null && Credentials.Federated.Prompt != null)
            {
                if (parameters != null)
                {
                    // Create a copy of the parameters if any were supplied.
                    parameters = new Dictionary <String, String>(parameters);
                }
                else
                {
                    parameters = new Dictionary <String, String>();
                }

                IVssCredentialPrompt promptToSetParametersOn;

                // prompt can be a VssCredentialPrompts with VssFederatedCredentialPrompt inside it
                IVssCredentialPrompts credentialPrompts = Credentials.Federated.Prompt as IVssCredentialPrompts;
                if (credentialPrompts != null && credentialPrompts.FederatedPrompt != null)
                {
                    // IVssCredentialPrompts contains an inner federatedPrompt, then set the paramaters on the inner one
                    promptToSetParametersOn = credentialPrompts.FederatedPrompt;
                }
                else
                {
                    promptToSetParametersOn = Credentials.Federated.Prompt;
                }

                parameters[VssConnectionParameterKeys.VssConnectionMode] = connectMode.ToString();
                promptToSetParametersOn.Parameters = parameters;
            }

            return(ServerDataProvider.ConnectAsync(ConnectOptions.None, cancellationToken));
        }