protected override void OnNavigatedTo(NavigationEventArgs args)
        {
            //Handle ExitOnBack=True arg...
            RscUtils.OnNavigatedTo_ExitOnBack(this.NavigationContext.QueryString);

            spItems.Children.Clear();

            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            m_txtTitle.Text = args.Uri.ToString();

            if (parameters.Count > 0)
            {
                List <NavToPar> ap = new List <NavToPar>();

                foreach (string sKey in parameters.Keys)
                {
                    ap.Add(new NavToPar(sKey, ""));
                }

                int iIdx = -1;
                foreach (string sValue in parameters.Values)
                {
                    iIdx++;
                    ap[iIdx].Value = sValue;
                }

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

            base.OnNavigatedTo(args);
        }
Пример #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);
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //Handle ExitOnBack=True arg...
            RscUtils.OnNavigatedTo_ExitOnBack(this.NavigationContext.QueryString);

            if (m_media != null)
            {
                return;
            }

            m_media = new MediaLibrary();
            m_pic   = null;

            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("token"))
            {
                m_sGUID = parameters["token"];
            }
            else if (parameters.ContainsKey("FileId"))
            {
                m_sGUID = parameters["FileId"];
            }
            else
            {
                return;
            }

            m_pic = m_media.GetPictureFromToken(m_sGUID);

            if (m_pic != null)
            {
                string sFName = m_pic.Name;
                string sFExt  = "";
                int    iPos   = sFName.LastIndexOf('.');
                if (iPos >= 0)
                {
                    sFExt  = sFName.Substring(iPos);
                    sFName = sFName.Substring(0, iPos);
                }

                m_sPicFileName = m_sGUID + sFExt;

                m_sPhoneFolder = "";
                PictureAlbum pa = m_pic.Album;
                for (;;)
                {
                    if (pa.Name.ToString().Length == 0)
                    {
                        break;
                    }

                    if (m_sPhoneFolder.Length > 0)
                    {
                        m_sPhoneFolder = "\\" + m_sPhoneFolder;
                    }
                    m_sPhoneFolder = pa.Name + m_sPhoneFolder;

                    pa = pa.Parent;
                    if (pa == null)
                    {
                        break;
                    }
                }

                m_sAppFolder = RscKnownFolders.GetMediaPath("Zune");
                if (m_sPhoneFolder.Length > 0)
                {
                    m_sAppFolder += "\\" + m_sPhoneFolder;
                }

                m_sAppPath = m_sAppFolder + "\\" + m_sPicFileName;

                string sNames = "";
                sNames        += "Name";
                sNames        += "\r\n";
                sNames        += "Time";
                sNames        += "\r\n";
                sNames        += "Size";
                sNames        += "\r\n";
                sNames        += "Folder";
                m_txtName.Text = sNames;

                string sInf = "";
                sInf          += m_pic.Name;
                sInf          += "\r\n";
                sInf          += m_pic.Date.ToShortDateString() + " " + m_pic.Date.ToShortTimeString();
                sInf          += "\r\n";
                sInf          += m_pic.Width.ToString() + " x " + m_pic.Height.ToString();
                sInf          += "\r\n";
                sInf          += m_sPhoneFolder;
                m_txtInfo.Text = sInf;

                m_sInf  = "";
                m_sInf += m_pic.Name;
                m_sInf += "\r\n";
                m_sInf += m_sGUID;
                m_sInf += "\r\n";
                m_sInf += m_pic.Date.ToShortDateString() + " | " + m_pic.Date.ToShortTimeString();
                m_sInf += "\r\n";
                m_sInf += m_pic.Width.ToString() + " x " + m_pic.Height.ToString();
                m_sInf += "\r\n";
                m_sInf += m_sPhoneFolder;

                AddSavedNote();

                /*
                 * if( bThumbnail )
                 * {
                 *      System.Windows.Media.Imaging.WriteableBitmap wbmp =
                 *              Microsoft.Phone.PictureDecoder.DecodeJpeg(pic.GetThumbnail(), iCX, iCY );
                 *
                 *      return wbmp;
                 * }
                 * else
                 * {
                 */
                BitmapImage bmp = new BitmapImage();
                bmp.SetSource(m_pic.GetImage());

                /*
                 *      return bmp;
                 * }
                 */

                imgFull.Source = bmp;
            }

            /*
             * else
             * {
             *
             *      imgFull.Source = m_isDummy;
             *
             * }
             */
        }