in

Community Blogs

Blogs of different SQL/Developers Community Members

This Blog

Syndication

DamirDobric

siječanj 2011 - Posts

  • How to get IP Addresses on Windows Phone device?

    Windows phone has a native API for dealing with underlying network stack. Long time ago daenet has implemented the tool called DHOST for Windows Mobile, which shows information about all adapters on device.
    I was a pretty disappointed as I heard that Windows Phone will not have public API at the release time. So I decided to it by using of undocumented API.

    This API is implemented in assembly called Iphlpapi. This assembly with the name which breaks all MS-guidelines supports following networks:

    Any
    Broadcast;
    IPv6Any
    IPv6Loopback
    IPv6None
    Loopback
    None

    Here is the peace of code which enumerates all adapters on device:

    IList<Iphlpapi.AdapterInfo> addresses = NativeAccess.Net.Iphlpapi.getIPAddresses();

    foreach (var addr in addresses)

    {
         
    msg += String.Format("{0}\r\n{1}\r\n{2}\r\n\r\n", addr.FriendlyName, addr.Address, addr.Description);

    }

     

    MessageBox.Show(msg);

    Note that this code will not work on Emulator, because emulator doe not have all required COM Dll-s. This API can also do meny other things.
    Here is an example which shows how to get the HostName.

    var hostName = Dns.GetHostName();

    It is interesting, that my host name is “SmartPhone”.

    We implemented finally the tool called DHost For Windows Phone, which will be available soon. Note that the first version will not be published in the public store, because it will probably not pass certification process Smile

    Here is the screenshot of the V1:

    image

    As you see my lab-device has 5 adapters Smile

  • How to start Application on Windows Phone Remotely

    First class you have to be aware of is DatastoreManager, which helps you to deal with embedded platforms. This class is implemented in assembly Microsoft.SmartDevice.Connectivity.dll,
    which is installed in GAC. If you need to reference it please look somewhere in some of VS folders.

    DatastoreManager manager = new DatastoreManage(CultureInfo.CurrentUICulture.LCID);

    One of most interesting methods is GetPlatforms. When I execute it on my test machine I get following result:

    manager.GetPlatforms()

    Count = 1
        [0]: {Windows Phone 7}

    Each platform is specified by its name and GUID. For example Windows Mobile 5 has a GUID "BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39". Windows Phone 7 platform has a GUID {E6B29E6-AAE1-41dc-9849-049507CBA2B0}.
    If you know the GUID you can instantiate the platform explicitly:

    Platform p = manager.GetPlatform(new ObjectId(new Guid(“E6B29E6-AAE1-41dc-9849-049507CBA2B0”));

    You might ask yourself why this can be important? Well, if you have a platform instance you can enumerate devices:

    foreach (Device device in platform.GetDevices())
    {

            device.Connect();        

            . . .        

            device.Disconnect();

    }


    Then, you can connect to device, perform some actions and close connection.
    Next example shows how to enumerate all applications at device (only installed by you!) and how to start them.

    ICollection<RemoteApplication> apps = device.GetInstalledApplications();
    foreach (var app in apps)
    {
        app.Launch();
    }

    In other words, you connect your phone by USB cable to your machine. At the machine you can start this code and all installed apps will be
    lunched at the device.

    By using of device instance you can do much more funny things Smile like install or delete some app and more.

    For example, if you know the ID of application which is build in (not installed by you) you can also start it. Good examples of such apps are
    all launchers and chooser.

    For example next snippet shows how to launch camera task:


    var cameraLauncher = device.GetApplication(new Guid("5B04B775-356B-4AA0-AAF8-6491FFEA5631"));

    cameraLauncher.Launch();

    Because every app at the phone has an ID (defined in WMAppManifest.xml) it can be accessed by device instance. Please don’t ask me how I found all those GUID-s Smile

  • BPOS Pricing

    Business Productivity Online Suite Standard Pricing
    The Standard Suite of Business Productivity Online includes Exchange Online, SharePoint® Online, Office Communications Online, and Office Live Meeting. You can offer the Standard Suite to your customers for $15.00 per seat.

    Standard Version
    The Standard Version is hosted in a shared environment. Customers can enroll for as little as five seats for one year.

    Dedicated Version
    As the name suggests, this version is hosted in a dedicated environment. A minimum of 5000 seats are needed to qualify for the Dedicated Version.

     

    Following diagram is best illustration of pricing model I ever seen:

    Posted sij 15 2011, 05:38 by anonymous
    Filed under:
  • Creating contracts for XmlSerializer

    When working with XmlSerializer you might notice that you generated contract contains double definitions for some or all types.
    This is shown at two following pictures. As you can see at marked places it is obvious that double definition comes form DataContract serializer, although you just want to use XmlSerializer.

     

    image

     

     

    image

    Next picture shows what causes this behavior.

    image

    XmlSerializerFormatAttribute enforces Metadata Exporter to create DataContract version of types. To workaround this remove this attribute from all operations:

     

     

     

    [System.ServiceModel.OperationContractAttribute(Action = "urn:epcglobal:epcis:wsdl:1:EPCISServicePortType:captureRequest", ReplyAction = "urn:epcglobal:epcis:wsdl:1:EPCISServicePortType:captureResponse")]

    //[System.ServiceModel.ServiceKnownTypeAttribute(typeof(EPCISException))]

    [System.ServiceModel.FaultContractAttribute(typeof(EPCISException), Action = "http://www.w3.org/2005/08/addressing/soap/fault", Name = "EPCISException", Namespace = "urn:epcglobal:epcis-query:xsd:1")]

    [System.ServiceModel.FaultContractAttribute(typeof(ValidationException), Action = "http://www.w3.org/2005/08/addressing/soap/fault", Name = "ValidationException", Namespace = "urn:epcglobal:epcis-query:xsd:1")]

    [System.ServiceModel.XmlSerializerFormatAttribute()]

    captureResponse capture(captureRequest req);

    [System.ServiceModel.OperationContractAttribute(Action = "urn:epcglobal:epcis:wsdl:1:EPCISServicePortType:getQueryNamesRequest", ReplyAction = "urn:epcglobal:epcis:wsdl:1:EPCISServicePortType:getQueryNamesResponse")]

    [System.ServiceModel.FaultContractAttribute(typeof(SecurityException), Action = "http://www.w3.org/2005/08/addressing/soap/fault", Name = "SecurityException", Namespace = "urn:epcglobal:epcis-query:xsd:1")]

    [System.ServiceModel.FaultContractAttribute(typeof(ValidationException), Action = "http://www.w3.org/2005/08/addressing/soap/fault", Name = "ValidationException", Namespace = "urn:epcglobal:epcis-query:xsd:1")]

    [System.ServiceModel.FaultContractAttribute(typeof(ImplementationException), Action = "http://www.w3.org/2005/08/addressing/soap/fault", Name = "ImplementationException", Namespace = "urn:epcglobal:epcis-query:xsd:1")]

    [System.ServiceModel.XmlSerializerFormatAttribute()]

    getQueryNamesResponse getQueryNames(getQueryNamesRequest request);

    /// <remarks/>
       [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
       [System.SerializableAttribute()]
       [System.Diagnostics.DebuggerStepThroughAttribute()]
       [System.ComponentModel.DesignerCategoryAttribute("code")]
       [System.Xml.Serialization.XmlTypeAttribute(TypeName="ValidationException", Namespace="
    http://schemas.datacontract.org/2004/07/Daenet.Tracking.Epcis")]
       public partial class ValidationException1 : EPCISException1 {
          
           private PropertyResult1[] propertyResultListField;
          
           /// <remarks/>
           [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true, Order=0)]
           [System.Xml.Serialization.XmlArrayItemAttribute(Namespace="
    http://schemas.datacontract.org/2004/07/Daenet.Tracking")]
           public PropertyResult1[] PropertyResultList {
               get {
                   return this.propertyResultListField;
               }
               set {
                   this.propertyResultListField = value;
                   this.RaisePropertyChanged("PropertyResultList");
               }
           }
       }

     

    Posted sij 06 2011, 11:18 by anonymous
    Filed under:
Copyright of SQL/Developers Community
Powered by Community Server (Commercial Edition), by Telligent Systems