Пример #1
0
        static void Main(string[] args)
        {
            string Server = "<server>";
            string Username = "******";
            string Password = "******";
            using (var obixClient = new XmlObixClient(new Uri(Server)))
            {
                obixClient.WebClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue
                    (
                    "Basic",
                    Convert.ToBase64String(
                        Encoding.ASCII.GetBytes(
                            string.Format("{0}:{1}", Username, Password))));

                var connectResult = obixClient.Connect();
                if (connectResult != ObixResult.kObixClientSuccess)
                {
                    throw new Exception("Connection to server failed: " +
                                        ObixResult.Message(connectResult));
                }

                var readResult = obixClient.ReadUriXml(new Uri(Server + "histories/"));
                if (readResult.ResultSucceeded)
                {
                    var element = readResult.Result;
                    System.Console.WriteLine(element.ToString());
                }
                else
                {
                    throw new Exception("Error reading from server: " + ObixResult.Message(readResult));
                }

                System.Console.ReadKey();
            }
        }
Пример #2
0
        public void GlobalCleanup() {
            if (client.ErrorStack.HasErrors) {
                Console.Out.WriteLine("\r\n\r\n\r\n");
                Console.Out.WriteLine("--- Error Stack ---");
                foreach (ObixError err in client.ErrorStack.PopArray()) {
                    Console.Out.WriteLine(err.ToString());
                    if (string.IsNullOrEmpty(err.AuxErrorMessage) == false) {
                        Console.Out.WriteLine(" - " + err.AuxErrorMessage);
                    }
                }
            }

            client.Dispose();
            client = null;
        }
Пример #3
0
 public void GlobalInitialize() {
     client = new XmlObixClient(obixLobby);
    
     Assert.IsNotNull(client, "Initializing the oBIX client failed.");
     client.ErrorStack.ErrorAdded += ObixError_ErrorAdded;
 }
Пример #4
0
 public XmlBatchClient(XmlObixClient ObixClient) {
     this.ObixClient = ObixClient;
 }
Пример #5
0
 public XmlBatchClient(XmlObixClient ObixClient)
 {
     this.ObixClient = ObixClient;
 }