void SetNewPath(string srcPath, string destFolder, string specificFolder, string filename, DependencyObject parentDO, bool overwrite = false) { try { bool fileOnDirectory = srcPath.StartsWith(Gibbo.Library.SceneManager.GameProject.ProjectPath); if (!fileOnDirectory) { System.IO.File.Copy(srcPath, destFolder + filename, overwrite); } string relativePath = (@"\Content\" + specificFolder + filename).Trim(); if (fileOnDirectory) { relativePath = srcPath.Replace(Gibbo.Library.SceneManager.GameProject.ProjectPath, string.Empty); } if (relativePath.StartsWith("\\")) { relativePath = relativePath.Substring(1, relativePath.Length - 1); } (parentDO as TextBox).Text = relativePath; EditorUtils.SelectAnotherElement <TextBox>(parentDO); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void LayoutTextBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { string layoutName = (sender as TextBox).Text.Trim(); if (layoutName.Equals(string.Empty)) { return; } if (LayoutHelper.RenameLayout(layoutName)) { (sender as TextBox).Text = ""; EditorUtils.SelectAnotherElement <TextBox>(sender as DependencyObject); } //if (LayoutHelper.LoadLayout(layoutName)) //{ // (sender as TextBox).Text = ""; // EditorUtils.SelectAnotherElement<TextBox>(sender as DependencyObject); //} //else //{ // if (LayoutHelper.CreateNewLayout(layoutName)) // { // (sender as TextBox).Text = ""; // EditorUtils.SelectAnotherElement<TextBox>(sender as DependencyObject); // } //} } }
void TagItemChanged(object sender, RoutedEventArgs e) { if ((sender as ComboBox).SelectedItem == null) { return; } DependencyObject parent = EditorUtils.GetParent(sender as ComboBox, 3); (parent as TextBox).Text = ((sender as ComboBox).SelectedItem as TextBlock).Text; EditorUtils.SelectAnotherElement <TextBox>(parent); }
void addLayoutMouseDown(object sender, RoutedEventArgs e) { DependencyObject parent = EditorUtils.GetParent(sender as TextBlock, 3); string layoutName = (parent as TextBox).Text.Trim(); if (layoutName.Equals(string.Empty)) { return; } if (LayoutHelper.CreateNewLayout(layoutName)) { (parent as TextBox).Text = ""; EditorUtils.SelectAnotherElement <TextBox>(parent); } }
private void addBtn_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { string text = this.addBtn.Text.Trim(); if (text.Equals(string.Empty)) { return; } if (!SceneManager.ActiveScene.CommonTags.Contains(text)) { SceneManager.ActiveScene.CommonTags.Add(text); } (sender as Xceed.Wpf.Toolkit.WatermarkTextBox).Text = ""; EditorUtils.SelectAnotherElement <Xceed.Wpf.Toolkit.WatermarkTextBox>(sender as Xceed.Wpf.Toolkit.WatermarkTextBox); this.refreshList(); } }