private void _ReadTextFile() { if (m_iIndex == 0) { m_btnPrev.Visibility = Rsc.Collapsed; } else { m_btnPrev.Visibility = Rsc.Visible; } if (m_iIndex >= (m_aPathes.Count - 1)) { m_btnNext.Visibility = Rsc.Collapsed; } else { m_btnNext.Visibility = Rsc.Visible; } m_btnShare.Visibility = Rsc.ConditionalVisibility(m_aPathes.Count > 0); if (m_aPathes.Count == 0) { m_AppFrame.StatusText = "0 of 0"; m_txtPath.Text = ""; m_aLines.Clear(); return; } m_AppFrame.StatusText = (m_iIndex + 1).ToString() + " of " + m_aPathes.Count.ToString(); m_sPath_TEMP = m_aPathes[m_iIndex]; m_txtPath.Text = m_sPath_TEMP; RscStore store = new RscStore(); bool bNotExist = false; m_sContent_TEMP = store.ReadTextFile(m_sPath_TEMP, "", out bNotExist); if (m_sContent_TEMP.Length == 0) { return; } m_aLines.Clear(); m_AppFrame.StartTimer("load", LayoutRoot, 1, 0, false); }
// // // // private void SetLastFile(string sLastFile, bool bIsFolder, long lSize = -1) { m_sLastFile = sLastFile; m_bLastFileIsFolder = bIsFolder; m_lLastFileSize = lSize; bool bHas = m_sLastFile.Length > 0; lastFilePanel.Visibility = Rsc.ConditionalVisibility(bHas); m_btnRemoteEnter.Visibility = Rsc.ConditionalVisibility(bHas && bIsFolder); m_btnDownloadMem.Visibility = Rsc.ConditionalVisibility(bHas && !bIsFolder && lSize >= 0); m_btnDownloadFile.Visibility = Rsc.ConditionalVisibility(bHas && !bIsFolder && lSize >= 0); m_btnRemoteDateTime.Visibility = Rsc.ConditionalVisibility(bHas); m_btnRemoteList.Visibility = Rsc.ConditionalVisibility(bHas && bIsFolder); m_txtLastFile.Text = m_sLastFile; }
public RscDlg_TxtInputV10() { InitializeComponent(); m_AppFrame = new RscAppFrame("Ressive.Hu", "Text Input 1.0", "Images/Ico001_Ressive.jpg" , this, AppTitleBar, AppStatusBar); // /////////////// m_AppFrame.OnNext += new Ressive.FrameWork.RscAppFrame.OnNext_EventHandler(m_AppFrame_OnNext); m_AppFrame.OnExit += new Ressive.FrameWork.RscAppFrame.OnExit_EventHandler(m_AppFrame_OnExit); RscPageArgsRetManager appArgsMgr = new RscPageArgsRetManager(); m_AppInput = appArgsMgr.GetInput(csClsName); if (m_AppInput != null) { m_AppFrame.AppTitle = m_AppInput.CallerAppTitle; m_AppFrame.AppIconRes = m_AppInput.CallerAppIconRes; lbStr.Text = m_AppInput.GetFlag(0); txStr.Text = m_AppInput.GetData(0); m_bUseHistory = (m_AppInput.GetFlag(3).Length == 0); lbHis.Visibility = Rsc.ConditionalVisibility(m_bUseHistory); scrl.Visibility = Rsc.ConditionalVisibility(m_bUseHistory); if (txStr.Text.Length == 0 && m_bUseHistory) { string sPath = "Software\\Ressive.Hu\\" + csClsName + "\\History"; sPath += "\\" + m_AppInput.CallerAppTitle; sPath += "\\" + m_AppInput.ID; txStr.Text = RscRegistry.ReadString(HKEY.HKEY_CURRENT_USER, sPath, "LastOk", ""); } _LoadHistory(); } }
private void m_AppFrame_OnTimer(object sender, RscAppFrameTimerEventArgs e) { switch (e.Reason) { case "list files_Cancel": { m_folders.Clear(); m_files.Clear(); m_AppFrame.SetStatusText("User canceled operation!", StatusColoring.Error); break; } case "list files": { string sFileFilter = txFilter.Text; if (sFileFilter.Length == 0) { sFileFilter = "*.*"; } sFileFilter = sFileFilter.Replace("\\", ""); sFileFilter = sFileFilter.Replace("/", ""); sFileFilter = sFileFilter.Replace(":", ""); sFileFilter = sFileFilter.Replace(('"').ToString(), ""); sFileFilter = sFileFilter.Replace("<", ""); sFileFilter = sFileFilter.Replace(">", ""); sFileFilter = sFileFilter.Replace("|", ""); RscFileItemDesc itCurrent; RscFileItemDesc it; RscStore store = new RscStore(); itCurrent = m_folders[e.Pos]; if (!itCurrent.bWalked) { if (chbRecurse.IsChecked.Value) { string[] fldrs = RscSort.OrderBy(store.GetFolderNames(itCurrent.Path, "*.*", chbShowHidden.IsChecked.Value)); foreach (string node in fldrs) { it = new RscFileItemDesc(m_AppFrame.Theme); it.bFolder = true; it.bWalked = false; it.strParent = itCurrent.Path; it.strFileName = node; e.Max++; it.Parent = m_folders; m_folders.Add(it); } } itCurrent.bWalked = true; if (e.Pos == e.Max) { e.Pos = 0; } } else { if (itCurrent.LastError.Length == 0) //Otherwise Not Exist!!! { string[] fles = RscSort.OrderBy(store.GetFileNames(itCurrent.Path, sFileFilter, chbShowHidden.IsChecked.Value)); foreach (string node in fles) { it = new RscFileItemDesc(m_AppFrame.Theme); it.bFolder = false; it.bWalked = false; it.strParent = itCurrent.Path; it.strFileName = node; it.Parent = m_files; m_files.Add(it); } } if (e.Pos == e.Max) { //ReQuery... lbFiles.ItemsSource = null; lbFiles.ItemsSource = m_files; btnRename.Visibility = Rsc.ConditionalVisibility(m_files.Count == 1 && m_folders.Count == 1); imgRename.Visibility = btnRename.Visibility; // ActionPanel.Visibility = Rsc.ConditionalVisibility( (m_files.Count > 0 || m_txtRootFldr.Text.Length > 0) && m_folders[0].LastError.Length == 0); m_btnDelete.Visibility = Rsc.ConditionalVisibility( (m_files.Count > 0 || m_folders.Count > 0 /*|| m_txtRootFldr.Text.Length > 0*/) && m_folders[0].LastError.Length == 0); // btnCopy.Visibility = Rsc.ConditionalVisibility( (m_files.Count > 0 /*|| m_txtRootFldr.Text.Length > 0*/) && m_folders[0].LastError.Length == 0); imgCopy.Visibility = btnCopy.Visibility; // btnMove.Visibility = Rsc.ConditionalVisibility( (m_files.Count > 0 /*|| m_txtRootFldr.Text.Length > 0*/) && m_folders[0].LastError.Length == 0); imgMove.Visibility = btnMove.Visibility; m_AppFrame.SetStatusText(m_files.Count.ToString() + " file(s) in " + m_folders.Count.ToString() + " folder(s) listed"); // // // if (m_sAutoOperation.Length > 0) { ActionPanel.Visibility = Rsc.Collapsed; switch (m_sAutoOperation) { case "AutoDelete": m_AppFrame.AutoClick(m_btnDelete, new System.Windows.RoutedEventHandler(m_btnDelete_Click)); break; } } // // // } } break; } default: m_AppFrame_OnTimer_Sub1(sender, e); break; } }
/* * private void ContentPanel_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e) * { * bool bNoChng = (m_sContentPanel.Width == e.NewSize.Width && m_sContentPanel.Height == e.NewSize.Height); * m_sContentPanel = e.NewSize; * * if( !bNoChng ) * { * if( e.NewSize.Width < e.NewSize.Height ) * imgBk.Source = m_AppFrame.Theme.GetImage("Images/Bk001_portrait.jpg"); * else * imgBk.Source = m_AppFrame.Theme.GetImage("Images/Bk001_landscape.jpg"); * } * } */ private void Instance_PlayStateChanged(object sender, EventArgs e) { switch (BackgroundAudioPlayer.Instance.PlayerState) { case PlayState.Playing: { m_AppFrame.StatusText = "Playing..."; m_currentPosition.Stop(); m_txtSnd.Text = BackgroundAudioPlayer.Instance.Track.Title; m_txtSnd.Text += " (" + BackgroundAudioPlayer.Instance.PlayerState.ToString() + ")"; m_btnPlayPause.Image.Source = m_isPause; m_btnPlayPause.Visibility = Rsc.Visible; m_btnExtOpen.Visibility = Rsc.Visible; m_btnStop.Visibility = Rsc.Visible; string sTag = BackgroundAudioPlayer.Instance.Track.Tag; if (sTag.Length > 0) { int iTag = 0; if (Int32.TryParse(sTag, out iTag)) { //ATT: Can happen... if ((iTag >= 0) && (iTag < m_sounds.Count)) { try { //m_txtSnd.Text += " " + iTag.ToString(); m_siInPlayer = m_sounds[iTag]; m_btnPrev.Visibility = Rsc.ConditionalVisibility(iTag > 0); m_btnNext.Visibility = Rsc.Visible; //Allowe to restart list... //Rsc.ConditionalVisibility( idx < (m_sounds.Count - 1) ); prsBarLen.Minimum = 0; prsBarLen.Maximum = (int)BackgroundAudioPlayer.Instance.Track.Duration.TotalMilliseconds; m_siInPlayer.sLen = RscUtils.toDurationStr(BackgroundAudioPlayer.Instance.Track.Duration); //Refresh... lbSounds.ItemsSource = null; lbSounds.ItemsSource = m_sounds; m_currentPosition.Start(); } catch (Exception) { //NOP... } } } } break; } case PlayState.Paused: { m_AppFrame.StatusText = "Paused..."; m_currentPosition.Stop(); m_txtSnd.Text = BackgroundAudioPlayer.Instance.Track.Title; m_txtSnd.Text += " (" + BackgroundAudioPlayer.Instance.PlayerState.ToString() + ")"; m_btnPlayPause.Image.Source = m_isPlay; m_btnPlayPause.Visibility = Rsc.Visible; m_btnExtOpen.Visibility = Rsc.Visible; m_btnStop.Visibility = Rsc.Visible; break; } case PlayState.Stopped: { m_AppFrame.StatusText = "Stopped..."; m_currentPosition.Stop(); m_txtSnd.Text = BackgroundAudioPlayer.Instance.Track.Title; m_txtSnd.Text += " (" + BackgroundAudioPlayer.Instance.PlayerState.ToString() + ")"; m_btnPlayPause.Image.Source = m_isPlay; m_btnPlayPause.Visibility = Rsc.Visible; m_btnExtOpen.Visibility = Rsc.Collapsed; m_btnStop.Visibility = Rsc.Collapsed; prsBarLen.Value = 0; break; } default: { m_txtSnd.Text = "Loading..."; //BackgroundAudioPlayer.Instance.PlayerState.ToString(); break; } } }
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(); } }