示例#1
0
        /*
         * private void _LoadHistory()
         * {
         *      if( !m_bUseHistory ) return;
         *
         *      spHis.Children.Clear();
         *
         *      string sPath = "Software\\Ressive.Hu\\" + csClsName + "\\History";
         *      sPath += "\\" + m_AppInput.CallerAppTitle;
         *      sPath += "\\" + m_AppInput.ID;
         *
         *      m_RegHistory = new RscRegistryValueList(HKEY.HKEY_CURRENT_USER, sPath);
         *
         *      for( int i = 0; i < m_RegHistory.Count; i++ )
         *      {
         *              _AddHis( m_RegHistory.Get( i ), i );
         *      }
         *      if( m_RegHistory.Count == 0 )
         *      {
         *              _AddHis( "<history is empty>", 0, true );
         *      }
         * }
         *
         * private void _AddHis(string sValue, int iIndex, bool bDummyItem = false)
         * {
         *      if( !m_bUseHistory ) return;
         *
         *      int idx = spHis.Children.Count + 1;
         *
         *      Grid grdOut = new Grid();
         *      grdOut.Name = "grdOut_" + idx.ToString();
         *      grdOut.Margin = new Thickness(0, 0, 0, 4 );
         *      ColumnDefinition cd;
         *      cd = new ColumnDefinition(); cd.Width = new GridLength(1, GridUnitType.Star); grdOut.ColumnDefinitions.Add(cd);
         *      cd = new ColumnDefinition(); cd.Width = GridLength.Auto; grdOut.ColumnDefinitions.Add(cd);
         *      spHis.Children.Add(grdOut);
         *      grdOut.Tag = iIndex;
         *
         *      TextBoxDenieEdit txtItem = new TextBoxDenieEdit(true, true, grdOut, Grid.ColumnProperty, 0);
         *      txtItem.Background = new SolidColorBrush(Colors.Gray);
         *      txtItem.Foreground = new SolidColorBrush(Colors.White);
         *      //txtItem.FontSize = 16;
         *      txtItem.Text = sValue;
         *
         *      if( bDummyItem ) return;
         *
         *      Button btn = txtItem.ButtonShield;
         *      btn.Click += new System.Windows.RoutedEventHandler(btn_Click);
         *
         *      RscIconButton btnRemove = new RscIconButton(grdOut, Grid.ColumnProperty, 1, 36, 36, Rsc.Visible);
         *      btnRemove.Image.Source = m_AppFrame.Theme.GetImage("Images/Btn001_Remove.jpg");
         *      btnRemove.Tag = grdOut;
         *      btnRemove.Click += new System.Windows.RoutedEventHandler(btnRemove_Click);
         *
         * }
         *
         * private void btn_Click(object sender, System.Windows.RoutedEventArgs e)
         * {
         *      Button btn = (Button) sender;
         *      TextBoxDenieEdit txtItem = (TextBoxDenieEdit) btn.Tag;
         *
         *      txStr.Text = txtItem.Text;
         *
         *      m_AppFrame.AutoClick( btnOk, btnOk_Click );
         * }
         *
         * private void btnRemove_Click(object sender, System.Windows.RoutedEventArgs e)
         * {
         *      Button btnRemove = (Button) sender;
         *      Grid grdOut = (Grid) btnRemove.Tag;
         *      int iIndex = (int) grdOut.Tag;
         *
         *      m_RegHistory.Delete( iIndex );
         *      spHis.Children.Remove(grdOut);
         * }
         */

        private void btnClearFn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (txStr.Text.Length == 0)
            {
                return;
            }

            txStr.Text = RscStore.ExtensionOfPath(txStr.Text);
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (m_AppArgs.Waiting)
            {
                RscPageArgsRet appOutput = m_AppArgs.GetOutput();
                if (appOutput != null)
                {
                    switch (appOutput.ID)
                    {
                    case "RootFldrPath":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            m_txtRootFldr.Text = appOutput.GetData(0);
                            ListFiles();
                        }
                        else
                        {
                            //NOP...
                        }
                        break;
                    }

                    case "CopyMove":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            m_sCopyMoveDest = appOutput.GetData(0);

                            if (chbRecurse.IsChecked.Value && (m_txtRootFldr.Text.Length == 0 || m_sCopyMoveDest.ToUpper().IndexOf(m_txtRootFldr.Text.ToUpper()) == 0))
                            {
                                MessageBox.Show("Unable to " + m_sCopyMove + " from parent folder to its' child folder.");
                            }
                            else
                            {
                                m_AppFrame.SetStatusText(m_sCopyMove + "...");
                                m_AppFrame.StartTimer("copy move files", LayoutRoot, 1, 0, true);
                            }
                        }
                        else
                        {
                            //NOP...
                        }
                        break;
                    }

                    case "txRenameTo":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            RscFileItemDesc it = m_files[0];

                            string sNewName = appOutput.GetData(0);

                            if (it.strFileName.ToUpper().CompareTo(sNewName.ToUpper()) != 0)
                            {
                                RscStore store = new RscStore();

                                string sNewPath = it.strParent;
                                if (sNewPath.Length > 0)
                                {
                                    sNewPath += "\\";
                                }
                                sNewPath += sNewName;

                                if (store.FileExists(sNewPath))
                                {
                                    MessageBox.Show("Name already in use!\r\n\r\n" + sNewPath);
                                }
                                else
                                {
                                    if (RscStore.ExtensionOfPath(sNewPath).ToUpper().CompareTo(RscStore.ExtensionOfPath(it.Path).ToUpper()) != 0)
                                    {
                                        if (MessageBoxResult.OK != MessageBox.Show("Do you really want to change type from " + RscStore.ExtensionOfPath(it.Path)
                                                                                   + " to " + RscStore.ExtensionOfPath(sNewPath) + "?\r\n\r\n(press Back to cancel)"))
                                        {
                                            return;
                                        }
                                    }

                                    try
                                    {
                                        store.MoveFile(it.Path, sNewPath);
                                    }
                                    catch (Exception exc)
                                    {
                                        MessageBox.Show("Rename failed!\r\n\r\n" + exc.Message);
                                        return;
                                    }

                                    if (txFilter.Text == it.strFileName)
                                    {
                                        txFilter.Text = sNewName;
                                    }
                                    it.strFileName = sNewName;

                                    //ReQuery...
                                    lbFiles.ItemsSource = null;
                                    lbFiles.ItemsSource = m_files;
                                }
                            }
                        }
                        else
                        {
                            //NOP...
                        }
                        break;
                    }
                    }
                }

                m_AppArgs.Clear();
            }
        }
        public void Create(string sPageNavTo, string sPageArgs, string sImage, string sStatus, string sIcoId = "")
        {
            RscStore store = new RscStore();

            Guid   gd       = Guid.NewGuid();
            string gdStr    = gd.ToString();
            string sPageUri = "/MainPage.xaml" + "?IcoGd=" + gdStr;

            if (sIcoId.Length > 0)
            {
                sPageUri += "&IcoId=" + sIcoId;
            }

            if (sIcoId.Length == 0)
            {
                string sStFldr = RscKnownFolders.GetTempPath("ShellTiles", "");
                store.WriteTextFile(sStFldr + "\\" + gdStr + ".txt", sPageNavTo + "\r\n" + sPageArgs, true);
            }
            else
            {
                //To make it enumerable...
                string sStFldr = RscKnownFolders.GetTempPath("ShellTiles", "");
                store.WriteTextFile(sStFldr + "\\" + gdStr + ".txt", sIcoId, true);
            }

            string sImageUri    = sImage;
            string sImgUriFinal = sImageUri;

            if (sImageUri.Length > 0)
            {
                string sTileImg = gdStr;
                if (sImageUri.IndexOf("isostore:\\") >= 0)
                {
                    sImageUri = sImageUri.Substring(10);
                    sTileImg += RscStore.ExtensionOfPath(sImageUri);
                }
                else
                {
                    sImageUri = sImageUri.Replace("Images/", "A:\\System\\Theme\\Current\\");
                    sImageUri = sImageUri.Replace(".jpg", ".png");
                    if (!store.FileExists(sImageUri))
                    {
                        sImageUri = sImageUri.Replace(".png", ".jpg");
                        sTileImg += ".jpg";
                    }
                    else
                    {
                        sTileImg += ".png";
                    }
                }

                string sTileImgPath = "A:\\Shared\\ShellContent";
                store.CreateFolderPath(sTileImgPath);
                sTileImgPath += "\\" + sTileImg;
                store.CopyFileForce(sImageUri, sTileImgPath);

                sImgUriFinal = "isostore:/" + sTileImgPath.Substring(3).Replace('\\', '/');
            }

            string sTitle = sStatus;

            if (sIcoId.Length > 0)
            {
                sTitle = "";

                Brush  brBk           = null;
                Brush  brFore         = null;
                double dFontSize      = 0;
                string sErr           = "";
                string sNotiTitle     = "";
                string sNotiContent   = "";
                string sNotiSound     = "";
                string sInfoToChngChk = "";

                string sInfo = GetInfo(true, sIcoId, out brBk, out brFore, out dFontSize,
                                       out sErr, out sNotiTitle, out sNotiContent, out sNotiSound,
                                       false, null, out sInfoToChngChk);

                if (sInfo == "")
                {
                    sInfo = "\n\n(N/A)";
                }
                if (brBk == null)
                {
                    brBk = new SolidColorBrush(Color.FromArgb(255, 32, 32, 32));                                    //Colors.Black );
                }
                if (brFore == null)
                {
                    brFore = new SolidColorBrush(Colors.White);
                }
                if (dFontSize > 0)
                {
                    dFontSize = cdFontSize - cdFontSize_SmDiff;
                }
                else
                {
                    dFontSize = cdFontSize;
                }
                if (sInfoToChngChk.Length == 0)
                {
                    sInfoToChngChk = sInfo;
                }

                //To update only if info has changed...
                string sStCntFldr = RscKnownFolders.GetTempPath("ShellTiles", "Content");
                store.WriteTextFile(sStCntFldr + "\\" + gdStr + ".txt", sInfo, true);

                string sTileImgPath = "A:\\Shared\\ShellContent";
                store.CreateFolderPath(sTileImgPath);
                sTileImgPath += "\\" + gdStr + ".jpg";
                store.DeleteFile(sTileImgPath);
                RenderText(sInfo, sTileImgPath, brBk, brFore, dFontSize);

                sImgUriFinal = "isostore:/" + sTileImgPath.Substring(3).Replace('\\', '/');
            }

            //MessageBox.Show( "Title: " + sTitle + "\r\n" + "NavTo: " + sPageUri + "\r\n" + "Image: " + sImageUri );

            StandardTileData initialData = new StandardTileData();

            {
                if (sImgUriFinal.Length > 0)
                {
                    initialData.BackgroundImage = new Uri(sImgUriFinal, UriKind.Absolute);
                }
                if (sTitle.Length > 0)
                {
                    initialData.Title = sTitle;
                }
            }
            ShellTile.Create(new Uri(sPageUri, UriKind.Relative), initialData);
        }
示例#4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (m_AppArgs.Waiting)
            {
                RscPageArgsRet appOutput = m_AppArgs.GetOutput();
                if (appOutput != null)
                {
                    switch (appOutput.ID)
                    {
                    case "SndFldrPath":
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            string sFolderIn = appOutput.GetData(0);

                            m_siInPlayer = null;
                            ClearAllSound();

                            RscStore store = new RscStore();

                            string[] fles = RscSort.OrderBy(store.GetFileNames(sFolderIn, "*.*"));
                            foreach (string sFle in fles)
                            {
                                string sExt = RscStore.ExtensionOfPath(sFle);

                                // FIX: To support Tube(HD)'s own local storage Video folder
                                //      where files are listed without extension!!!
                                bool bInclude = (sExt == "");

                                string strFileGroup = RscRegFs.GetFileGroupEx(sExt);
                                switch (strFileGroup)
                                {
                                case "Sound.Native":
                                case "Video.Native":
                                {
                                    bInclude = true;
                                    break;
                                }
                                }

                                if (bInclude)
                                {
                                    SoundInfo si = AddSound(sFolderIn + "\\" + sFle);
                                    if (m_siInPlayer == null)
                                    {
                                        m_siInPlayer = si;
                                    }
                                }
                            }

                            if (m_siInPlayer != null)
                            {
                                DoPlay();
                            }

                            RscRegistry.WriteString(HKEY.HKEY_CURRENT_USER, "Software\\Ressive.Hu\\RscViewer_SoundV11"
                                                    , "LastOk", sFolderIn);
                        }
                        else
                        {
                            //NOP...
                        }
                        break;
                    }
                }

                m_AppArgs.Clear();
            }
        }
示例#5
0
        private void RscViewer_SoundV10_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            m_AppFrame.SetNoSleep(true);

            if (m_bLoaded)
            {
                return;
            }
            m_bLoaded = true;

            m_currentPosition.Tick += new System.EventHandler(m_currentPosition_Tick);

            RscPageArgsRetManager appArgsMgr = new RscPageArgsRetManager();

            appInput = appArgsMgr.GetInput(csPageName);

            if (appInput != null)
            {
                m_AppFrame.AppTitle   = appInput.CallerAppTitle;
                m_AppFrame.AppIconRes = appInput.CallerAppIconRes;

                int iIndex = 0;
                if (!Int32.TryParse(appInput.GetFlag(0), out iIndex))
                {
                    return;
                }

                //NOT NEEDED...

                /*
                 * if( !double.TryParse( appInput.GetFlag(1), out dWidth ) ) return;
                 * if( !double.TryParse( appInput.GetFlag(2), out dHeight ) ) return;
                 */

                m_siInPlayer = null;
                ClearAllSound();

                for (int i = 0; i < appInput.DataCount; i++)
                {
                    SoundInfo si = AddSound(appInput.GetData(i));
                    if (i == iIndex)
                    {
                        m_siInPlayer = si;
                    }
                }

                if (m_siInPlayer != null)
                {
                    DoPlay();
                }

                //Denie to auto-reload on next start...
                appArgsMgr.Vipe();
            }
            else
            {
                string sLastOk = RscRegistry.ReadString(HKEY.HKEY_CURRENT_USER, "Software\\Ressive.Hu\\RscViewer_SoundV11"
                                                        , "LastOk", "");
                if (sLastOk.Length > 0)
                {
                    try
                    {
                        m_siInPlayer = null;

                        //DO NOT!!!
                        //ClearAllSound();

                        RscStore store = new RscStore();

                        string[] fles = RscSort.OrderBy(store.GetFileNames(sLastOk, "*.*"));
                        foreach (string sFle in fles)
                        {
                            string sExt = RscStore.ExtensionOfPath(sFle);

                            // FIX: To support Tube(HD)'s own local storage Video folder
                            //      where files are listed without extension!!!
                            bool bInclude = (sExt == "");

                            string strFileGroup = RscRegFs.GetFileGroupEx(sExt);
                            switch (strFileGroup)
                            {
                            case "Sound.Native":
                            case "Video.Native":
                            {
                                bInclude = true;
                                break;
                            }
                            }

                            if (bInclude)
                            {
                                SoundInfo si = AddSound(sLastOk + "\\" + sFle);
                                if (m_siInPlayer == null)
                                {
                                    m_siInPlayer = si;
                                }
                            }
                        }

                        //DO NOT!!!

                        /*
                         * if( m_siInPlayer != null )
                         * {
                         *      DoPlay();
                         * }
                         */
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
        private void LoadContent( )
        {
            string sPath = m_sPath_TEMP;

            m_sPath_TEMP = "";
            string sContent = m_sContent_TEMP;

            m_sContent_TEMP = "";

            // //
            //

            string sExt = RscStore.ExtensionOfPath(sPath);

            sExt = sExt.ToUpper();
            switch (sExt)
            {
            case ".VCF":

                RscTextTags_VCF tags = new RscTextTags_VCF();
                m_tags = tags;

                tags.Parse(sContent, "\r\n", ":", ";");

                if (tags.PhotoPresent && tags.PhotoIsBase64 && tags.PhotoIs("JPEG"))
                {
                    string sBase64 = tags.PhotoData;

                    //RscFs.WriteTextFile( "vcf.photo.txt", sBase64, true );

                    byte [] ayImage = Convert.FromBase64String(sBase64);

                    if (ayImage != null)
                    {
                        if (ayImage.Length > 0)
                        {
                            /*
                             * RscStore store = new RscStore();
                             * if( store.FileExists("vcf.photo.jpg") ) store.DeleteFile("vcf.photo.jpg");
                             * System.IO.Stream stream = store.CreateFile("vcf.photo.jpg");
                             * stream.Write( ayImage, 0, ayImage.Length );
                             * stream.Close();
                             */

                            System.IO.MemoryStream ms = new System.IO.MemoryStream(ayImage.Length);
                            ms.Write(ayImage, 0, ayImage.Length);
                            ms.Seek(0, System.IO.SeekOrigin.Begin);

                            BitmapImage bmp = new BitmapImage();
                            bmp.SetSource(ms);

                            ms.Close();

                            Img.Source     = bmp;
                            Img.Visibility = Rsc.Visible;
                        }
                        else
                        {
                            Img.Visibility = Rsc.Collapsed;
                        }
                    }
                    else
                    {
                        Img.Visibility = Rsc.Collapsed;
                    }
                }
                else
                {
                    //MessageBox.Show( "No photo present!" );
                    Img.Visibility = Rsc.Collapsed;
                }

                btnCall.Content    = "Call " + tags.PhoneNumber(0);
                BtnGrid.Visibility = Rsc.ConditionalVisibility(tags.PhoneNumber(0).Length > 0);

                RscStore store = new RscStore();

                bool bExists = false;
                if (store.FolderExists("A:\\Desktop"))
                {
                    if (store.FolderExists("A:\\Desktop\\Contacts"))
                    {
                        bExists = store.FileExists("A:\\Desktop\\Contacts\\" + tags.Name + ".txt");
                    }
                }

                if (bExists)
                {
                    btnEx.Content        = "Remove from Desktop";
                    BtnGridEx.Background = new SolidColorBrush(Colors.Red);
                }
                else
                {
                    btnEx.Content        = "Add to Desktop";
                    BtnGridEx.Background = new SolidColorBrush(Colors.Green);
                }
                BtnGridEx.Visibility = Rsc.ConditionalVisibility(tags.PhoneNumber(0).Length > 0);

                break;

            default:
                Img.Visibility     = Rsc.Collapsed;
                BtnGrid.Visibility = Rsc.Collapsed;
                m_tags             = null;
                break;
            }

            //
            // //

            if (m_tags == null)
            {
                m_aLines.FontSize = 18;

                m_aLines.Text = sContent;
            }
            else
            {
                m_aLines.FontSize = 22;

                m_aLines.Text = m_tags.ToString();
            }
        }