override public void Expand()
            {
                if (ContainerID.Length == 0)
                {
                    return;
                }

                // ???

                /*
                 * if( tiCurrent.Children.Count > 0 )
                 * {
                 *      //TODO...
                 *      return;
                 * }
                 */

                //VERY SLOW!!!
                //m_aTI.PreRefresh();

                PreInserts();

                switch (ContainerID)
                {
                default:
                {
                    Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceList nil
                        = new Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceList();
                    foreach (Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceInfo nii in nil)
                    {
                        if (ContainerID == nii.InterfaceName)
                        {
                            TreeLbItem ti;

                            ti = new TreeLbItem(Holder, this, "",
                                                "Interface Name",
                                                nii.InterfaceName);
                            Insert(ti);

                            ti = new TreeLbItem(Holder, this, "",
                                                "Description",
                                                nii.Description + " ");
                            Insert(ti);

                            ti = new TreeLbItem(Holder, this, "",
                                                "Interface State",
                                                nii.InterfaceState.ToString());
                            Insert(ti);

                            ti = new TreeLbItem(Holder, this, "",
                                                "Interface Type",
                                                nii.InterfaceType.ToString());
                            Insert(ti);

                            ti = new TreeLbItem(Holder, this, "",
                                                "Characteristics",
                                                nii.Characteristics.ToString());
                            Insert(ti);

                            ti = new TreeLbItem(Holder, this, "",
                                                "Bandwidth",
                                                nii.Bandwidth.ToString());
                            Insert(ti);

                            break;
                        }
                    }

                    break;
                }

                case "Network Interface List":
                {
                    Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceList nil
                        = new Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceList();
                    foreach (Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceInfo nii in nil)
                    {
                        TreeLbItem ti = new TreeLbItem(Holder, this, nii.InterfaceName, nii.InterfaceName);
                        Insert(ti);
                    }

                    break;
                }

                case "Device Network Information":
                {
                    string     sValue;
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "",
                                        "Cellular Mobile Operator",
                                        Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.CellularMobileOperator + " ");
                    Insert(ti);

                    sValue = "No";
                    if (Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsCellularDataEnabled)
                    {
                        sValue = "Yes";
                    }
                    ti = new TreeLbItem(Holder, this, "",
                                        "Is Cellular Data Enabled",
                                        sValue);
                    Insert(ti);

                    sValue = "No";
                    if (Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsCellularDataRoamingEnabled)
                    {
                        sValue = "Yes";
                    }
                    ti = new TreeLbItem(Holder, this, "",
                                        "Is Cellular Data Roaming Enabled",
                                        sValue);
                    Insert(ti);

                    sValue = "No";
                    if (Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsNetworkAvailable)
                    {
                        sValue = "Yes";
                    }
                    ti = new TreeLbItem(Holder, this, "",
                                        "Is Network Available",
                                        sValue);
                    Insert(ti);

                    sValue = "No";
                    if (Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsWiFiEnabled)
                    {
                        sValue = "Yes";
                    }
                    ti = new TreeLbItem(Holder, this, "",
                                        "Is WiFi Enabled",
                                        sValue);
                    Insert(ti);

                    break;
                }

                case "Network":
                {
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "Device Network Information", "Device Network Information");
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "Network Interface List", "Network Interface List");
                    Insert(ti);

                    break;
                }

                case "Device.Rsc":
                {
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "",
                                        "RscUtils.GetDeviceName",
                                        "\"" + RscUtils.GetDeviceName() + "\"" + "\n\n"
                                        + "Networking.Proximity.PeerFinder.DisplayName =\n"
                                        + Windows.Networking.Proximity.PeerFinder.DisplayName);
                    Insert(ti);

                    break;
                }

                case "Device.DeviceStatus":
                {
                    string     sValue;
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Name",
                                        Microsoft.Phone.Info.DeviceStatus.DeviceName);
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Manufacturer",
                                        Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer);
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Total Memory",
                                        RscUtils.toMBstr(Microsoft.Phone.Info.DeviceStatus.DeviceTotalMemory, false));
                    Insert(ti);

                    sValue = "No";
                    if (Microsoft.Phone.Info.DeviceStatus.IsKeyboardDeployed)
                    {
                        sValue = "Yes";
                    }
                    ti = new TreeLbItem(Holder, this, "",
                                        "Is Keyboard Deployed",
                                        sValue);
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Power Source",
                                        Microsoft.Phone.Info.DeviceStatus.PowerSource.ToString());
                    Insert(ti);

                    break;
                }

                case "Device.Environment":
                {
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Type",
                                        Microsoft.Devices.Environment.DeviceType.ToString());
                    Insert(ti);

                    break;
                }

                case "Device.ExtendedProperties":
                {
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Name",
                                        Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceName").ToString());
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Manufacturer",
                                        Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceManufacturer").ToString());
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Firmware Version",
                                        Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceFirmwareVersion").ToString());
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "",
                                        "Device Hardware Version",
                                        Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceHardwareVersion").ToString());
                    Insert(ti);

                    break;
                }

                case "Device":
                {
                    TreeLbItem ti;

                    ti = new TreeLbItem(Holder, this, "Device.Rsc", "Rsc");
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "Device.DeviceStatus", "Device Status");
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "Device.Environment", "Device Environment");
                    Insert(ti);

                    ti = new TreeLbItem(Holder, this, "Device.ExtendedProperties", "Device Extended Properties");
                    Insert(ti);

                    break;
                }
                }

                base.Expand();
            }
Example #2
0
        protected override void OnNavigatedTo(NavigationEventArgs args)
        {
            //Handle ExitOnBack=True arg...
            RscUtils.OnNavigatedTo_ExitOnBack(this.NavigationContext.QueryString);

            spItems.Children.Clear();

            List <NavToPar> ap = new List <NavToPar>();

            NavToPar np;
            string   sBool;

            np = new NavToPar("RscUtils.GetDeviceName",
                              "\"" + RscUtils.GetDeviceName() + "\"");
            ap.Add(np);

            np = new NavToPar("(Networking.Proximity.PeerFinder) Display Name",
                              Windows.Networking.Proximity.PeerFinder.DisplayName);
            ap.Add(np);

            /*
             * var deviceInformation = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
             * console.log(deviceInformation.systemSku);
             * np = new NavToPar( "(ExchangeActiveSyncProvisioning) systemSku",
             *      deviceInformation.systemSku );
             * ap.Add( np );
             */

            np = new NavToPar("(DeviceStatus) Device Name",
                              Microsoft.Phone.Info.DeviceStatus.DeviceName);
            ap.Add(np);

            np = new NavToPar("(Extended Properties) Device Name",
                              Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceName").ToString());
            ap.Add(np);

            np = new NavToPar("(DeviceStatus) Device Manufacturer",
                              Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer);
            ap.Add(np);

            np = new NavToPar("(DeviceStatus) Device Hardware Version",
                              Microsoft.Phone.Info.DeviceStatus.DeviceHardwareVersion);
            ap.Add(np);

            np = new NavToPar("(DeviceStatus) Device Total Memory",
                              RscUtils.toMBstr(Microsoft.Phone.Info.DeviceStatus.DeviceTotalMemory, false));
            ap.Add(np);

            sBool = "No";
            if (Microsoft.Phone.Info.DeviceStatus.IsKeyboardDeployed)
            {
                sBool = "Yes";
            }
            np = new NavToPar("(DeviceStatus) Is Keyboard Deployed",
                              sBool);
            ap.Add(np);

            np = new NavToPar("(DeviceStatus) Power Source",
                              Microsoft.Phone.Info.DeviceStatus.PowerSource.ToString());
            ap.Add(np);

            np = new NavToPar("(Environment) Device Type",
                              Microsoft.Devices.Environment.DeviceType.ToString());
            ap.Add(np);

            np = new NavToPar("(Extended Properties)Device Firmware Version",
                              Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceFirmwareVersion").ToString());
            ap.Add(np);

            np = new NavToPar("(Extended Properties)Device Hardware Version",
                              Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceHardwareVersion").ToString());
            ap.Add(np);

            np = new NavToPar("(Extended Properties)Device Manufacturer",
                              Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceManufacturer").ToString());
            ap.Add(np);

            foreach (NavToPar p in ap)
            {
                AddItem(false, p.Key, p.Value);
            }

            base.OnNavigatedTo(args);
        }