Exemplo n.º 1
0
        public void DeleteFile(object sender, RoutedEventArgs e)
        {
            BaseUserControl baseUserControl = null;

            if (!needControlFileName.EndsWith(".lightScript"))
            {
                for (int i = 0; i < mw.editUserControl.userControls.Count; i++)
                {
                    if (needControlFileName.EndsWith(mw.editUserControl.userControls[i]._fileExtension))
                    {
                        baseUserControl = mw.editUserControl.userControls[i];
                        break;
                    }
                }
            }
            else
            {
                baseUserControl = mw.editUserControl.userControls[3] as BaseUserControl;
            }

            if (baseUserControl == null)
            {
                return;
            }
            baseUserControl.filePath = needControlFileName;
            baseUserControl.DeleteFile(sender, e);

            if (baseUserControl == mw.editUserControl.userControls[3])
            {
                baseUserControl.HideControl();
            }

            mw.tbFileName.Text = String.Empty;
            ((needControlListBoxItem as TreeViewItem).Parent as ItemsControl).Items.Remove(needControlListBoxItem as TreeViewItem);
            //tvMain.Items.Remove(tvMain.SelectedItem);

            //for (int i = 0; i < lbFile.Items.Count; i++)
            //{
            //    if ((lbFile.Items[i] as ListBoxItem).Items.Contains(needControlListBoxItem))
            //    {
            //        (lbFile.Items[i] as ListBoxItem).Items.Remove(needControlListBoxItem);
            //    }
            //}
        }
Exemplo n.º 2
0
        public void DeleteFile(object sender, RoutedEventArgs e)
        {
            BaseUserControl baseUserControl = null;

            if (!needControlFileName.EndsWith(".lightScript"))
            {
                for (int i = 0; i < userControls.Count; i++)
                {
                    if (needControlFileName.EndsWith(userControls[i]._fileExtension))
                    {
                        baseUserControl = userControls[i];
                        break;
                    }
                }
            }
            else
            {
                baseUserControl = userControls[3] as BaseUserControl;
            }

            if (baseUserControl == null)
            {
                return;
            }
            baseUserControl.filePath = needControlFileName;
            baseUserControl.DeleteFile(sender, e);

            if (baseUserControl == userControls[3])
            {
                baseUserControl.HideControl();
            }

            //lbFile.Items.RemoveAt();


            //for (int i = 0; i < lbFile.Items.Count; i++)
            //{
            //    if ((lbFile.Items[i] as ListBoxItem).Items.Contains(needControlListBoxItem))
            //    {
            //        (lbFile.Items[i] as ListBoxItem).Items.Remove(needControlListBoxItem);
            //    }
            //}
        }
Exemplo n.º 3
0
        public bool DeleteFile(String fileName)
        {
            BaseUserControl baseUserControl = GetNeedControlBaseUserControl(fileName);

            if (baseUserControl == null)
            {
                return(false);
            }
            baseUserControl.filePath = fileName;
            baseUserControl.DeleteFile(null, null);

            if (baseUserControl == mw.editUserControl.userControls[3])
            {
                baseUserControl.HideControl();
            }

            mw.tbFileName.Text = String.Empty;
            return(true);
        }