void ResetPreviewPane() { ActiveViewer = ImageView; ImageCanvas.Source = null; TextView.Clear(); CurrentTextInput = null; }
private void ShowFileList() { TextView?.Clear(); ListViewData?.Clear(); mDataManages?.ClearData(); JsonRadioBtnChecked = true; TemplateRadioBtnChecked = false; //JsonView_RadioBtn.IsChecked = JsonRadioBtnChecked; //TemplateView_RadioBtn.IsChecked = TemplateRadioBtnChecked; //this.Width = this.MinWidth; if (Directory.Exists(ExcelPath.Text) && ExcelListView != null) { DirectoryInfo TheFolder = new DirectoryInfo(ExcelPath.Text); int idx = 0; foreach (var item in TheFolder.GetFiles()) { if (item.Extension.Equals(".xlsx") || item.Extension.Equals(".xls")) { ListViewData.Add(new ListViewItemData((idx++).ToString(), item)); } } } if (mBgShowFileList != null && !mBgShowFileList.IsBusy) { mBgShowFileList.RunWorkerAsync(); } if (ProgressBar != null) { ProgressBar.Value = 0; } }
void UpdatePreviewPane(Entry entry) { SetStatusText(""); var vm = ViewModel; m_current_preview = new PreviewFile { Path = vm.Path, Name = entry.Name, Entry = entry }; ImageCanvas.Source = null; TextView.Clear(); if (!IsPreviewPossible(entry)) { ActiveViewer = ImageView; return; } if ("image" != entry.Type) { LoadPreviewText(m_current_preview); } else if (!m_preview_worker.IsBusy) { m_preview_worker.RunWorkerAsync(m_current_preview); } else { m_preview_pending = true; } }
private IEnumerator Sample() { //yield return new WaitForSeconds(_firstTimeBeforeStart); TextView textView = _uiContainer.GameTextSample.GetComponent <TextView>(); for (uint i = 1; i <= 100; i++) { GameData gameData = _gameModelCore.GetGameData(i); textView.WriteNumberAndResult(gameData.Number, gameData.Line); yield return(new WaitForSeconds(_timeBeforeNextNumber)); } textView.Clear(); }
/// <summary> /// Open selected file to display right panel. /// </summary> /// <param name="id"></param> private void PreviewById(uint id) { PackResource Res = m_Pack.GetFileByIndex(id); Status.Text = Properties.Resources.Str_LoadingPreview; this.Update(); if (Res != null) { PicturePanel.Hide(); hexBox.ResetText(); TextView.Hide(); pPlay.Hide(); String InternalName = Res.GetName(); string Ext = Path.GetExtension(@InternalName); // loading file content. byte[] buffer = new byte[Res.GetSize()]; Res.GetData(buffer); Res.Close(); MemoryStream ms = new MemoryStream(buffer); switch (Ext) { case ".dds": case ".tga": case ".jpg": case ".gif": case ".png": case ".bmp": if (handle.IsAllocated) { handle.Free(); } string Info = ""; switch (Ext) { case ".dds": case ".tga": Info = "DDS (Direct Draw Surfice)"; break; case ".jpg": Info = "JPEG"; break; case ".gif": Info = "GIF"; break; case ".bmp": Info = "Bitmap"; break; case ".png": Info = "PNG (Portable Network Graphic)"; break; } if (Ext == ".tga" || Ext == ".dds") { PictureView.Image = DDS2Bitmap(ms); } else { PictureView.Image = Image.FromStream(ms); } PictureView.Update(); Status.Text = String.Format("{0} Image file. ({1} x {2})", Info, PictureView.Width, PictureView.Height); PictureView.SizeMode = PictureBoxSizeMode.AutoSize; PicturePanel.AutoScroll = true; PicturePanel.Update(); PicturePanel.Show(); break; case ".xml": case ".html": case ".txt": case ".trn": string text = Encoding.Unicode.GetString(buffer); TextView.Clear(); TextView.Text = text; TextView.Update(); TextView.Show(); Status.Text = String.Format("Ascii file."); break; case ".wav": case ".mp3": pPlay.Show(); // http://msdn.microsoft.com/en-us/library/ms143770%28v=VS.100%29.aspx this.wave = new WavePlayer(buffer); this.wave.Play(); Status.Text = "Sound file."; break; default: if (InternalName == "vf.dat") { TextView.Clear(); TextView.Text = Encoding.ASCII.GetString(buffer); TextView.Update(); TextView.Show(); Status.Text = "Version infomation."; } else { DynamicByteProvider d = new DynamicByteProvider(buffer); hexBox.ByteProvider = d; Status.Text = "Unknown file."; } break; } ms.Dispose(); } this.Update(); }
private void Format(string option) { switch (option.ToUpper()) { case "B": try { SelectCurrentLine(); FontStyle style = new FontStyle(); if (TextView.SelectionFont.Bold) { style = style | FontStyle.Regular; } else { style = style | FontStyle.Bold; } if (TextView.SelectionFont.Italic) { style = style | FontStyle.Italic; } if (TextView.SelectionFont.Underline) { style = style | FontStyle.Underline; } TextView.SelectionFont = new Font(TextView.SelectionFont, style); TextView.DeselectAll(); } catch { }; break; case "I": try { SelectCurrentLine(); FontStyle style = new FontStyle(); if (TextView.SelectionFont.Italic) { style = style | FontStyle.Regular; } else { style = style | FontStyle.Italic; } if (TextView.SelectionFont.Bold) { style = style | FontStyle.Bold; } if (TextView.SelectionFont.Underline) { style = style | FontStyle.Underline; } TextView.SelectionFont = new Font(TextView.SelectionFont, style); TextView.DeselectAll(); } catch { }; break; case "U": try { SelectCurrentLine(); FontStyle style = new FontStyle(); if (TextView.SelectionFont.Underline) { style = style | FontStyle.Regular; } else { style = style | FontStyle.Underline; } if (TextView.SelectionFont.Italic) { style = style | FontStyle.Italic; } if (TextView.SelectionFont.Bold) { style = style | FontStyle.Bold; } TextView.SelectionFont = new Font(TextView.SelectionFont, style); TextView.DeselectAll(); } catch { }; break; case "T": try { SelectCurrentLine(); FontDialog fd = new FontDialog(); fd.Font = TextView.SelectionFont; if (fd.ShowDialog() == DialogResult.OK) { TextView.SelectionFont = fd.Font; } TextView.DeselectAll(); } catch { }; break; case "UP": TextView.SelectionAlignment = HorizontalAlignment.Center; break; case "RIGHT": TextView.SelectionAlignment = HorizontalAlignment.Right; break; case "LEFT": TextView.SelectionAlignment = HorizontalAlignment.Left; break; case "A": TextView.SelectAll(); break; case "C": TextView.Copy(); break; case "V": TextView.Paste(); break; case "X": TextView.Cut(); break; case "Z": TextView.Undo(); break; case "Y": TextView.Redo(); break; case "P": SelectCurrentLine(); if (TextView.SelectionProtected) { TextView.SelectionColor = Color.FromArgb( (TextView.SelectionColor.R + 70 > 255) ? 255 : TextView.SelectionColor.R + 70, (TextView.SelectionColor.G + 70 > 255) ? 255 : TextView.SelectionColor.G + 70, (TextView.SelectionColor.B + 70 > 255) ? 255 : TextView.SelectionColor.B + 70 ); TextView.SelectionProtected = false; } else { TextView.SelectionColor = Color.FromArgb( (TextView.SelectionColor.R - 70 < 0) ? 0 : TextView.SelectionColor.R - 70, (TextView.SelectionColor.G - 70 < 0) ? 0 : TextView.SelectionColor.G - 70, (TextView.SelectionColor.B - 70 < 0) ? 0 : TextView.SelectionColor.B - 70 ); TextView.SelectionProtected = true; } TextView.DeselectAll(); break; case "R": SelectCurrentLine(); ColorDialog CD = new ColorDialog(); if (CD.ShowDialog() == DialogResult.OK) { TextView.SelectionColor = CD.Color; } TextView.DeselectAll(); break; case "S": save(true); break; case "N": if (MessageBox.Show("Do you want to create a new file?", "New File", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CurrentFile = ""; TextView.Clear(); TextView.ForeColor = txt_color.ForeColor; TextView.BackColor = bg_color.BackColor; } break; case "O": OpenFileDialog OFD = new OpenFileDialog(); OFD.Title = "Select a file to open"; if (OFD.ShowDialog() == DialogResult.OK) { try { TextView.LoadFile(OFD.FileName); } catch { try { TextView.Text = System.IO.File.ReadAllText(OFD.FileName); } catch { } } CurrentFile = OFD.FileName; Properties.Settings.Default.last_opened_file = CurrentFile; Properties.Settings.Default.Save(); } break; case "Q": if (MessageBox.Show("Do you want to delete all?", "Delete All", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { TextView.SelectionProtected = false; TextView.Clear(); TextView.ForeColor = txt_color.ForeColor; TextView.BackColor = bg_color.BackColor; } break; case "D": DuplicateLine(); break; case "E": CheckForFunctions(); break; } }