Esempio n. 1
0
        protected override void CloneTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            base.CloneTextBox_LostFocus(sender, e);
            if (!IsValid)
            {
                return;
            }
            var mouseEventArgs = e as MouseEventArgs;

            if (e != null && mouseEventArgs == null)
            {
                return;
            }
            if (e != null)
            {
                var clickPosition = mouseEventArgs.GetPosition(MainControl);
                if (CloneTextBoxLocation.Contains((int)clickPosition.X, (int)clickPosition.Y))
                {
                    return;
                }
            }
            if (CloneTextBox.Tag.ToString() != CloneTextBox.Text)
            {
                string name = CloneTextBox.Tag.ToString();
                //File.Move(file, Path.GetDirectoryName(file) + "\\" + CloneTextBox.Text + Path.GetExtension(file));
                Notes.Add(CloneTextBox.Text, Notes[name]);
                Notes[CloneTextBox.Text].Name = CloneTextBox.Text;
                Notes.Remove(name);
            }
            MainControl.Items.Refresh();
            EndChangingDynamicItem();
        }
Esempio n. 2
0
        protected override void CloneTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            base.CloneTextBox_LostFocus(sender, e);
            if (!IsValid)
            {
                return;
            }
            var mouseEventArgs = e as MouseEventArgs;

            if (e != null && mouseEventArgs == null)
            {
                return;
            }
            if (e != null)
            {
                var clickPosition = mouseEventArgs.GetPosition(MainProjectList);
                if (CloneTextBoxLocation.Contains((int)clickPosition.X, (int)clickPosition.Y))
                {
                    return;
                }
            }
            if (CloneTextBox.Tag.ToString() != CloneTextBox.Text)
            {
                if (!ChangedFileName)
                {
                    RenameProject(CloneTextBox.Tag.ToString(), CloneTextBox.Text);
                }
                else
                {
                    LoadedFile file = Notes[CurentProject.Name].Files.Where(item => item.Path == CloneTextBox.Tag.ToString()).FirstOrDefault();
                    if (file == null)
                    {
                        return;
                    }
                    string directoryPath = Path.GetDirectoryName(file.Path) + "\\";
                    RenameFileInProject(Directory.GetParent(directoryPath).Parent.Name, file, CloneTextBox.Text);
                    IsChangeFileName = false;
                }
            }
            MainProjectList.Items.Refresh();
            EndChangingDynamicItem();
        }