Esempio n. 1
0
        public EditorTable(LPSEditor lpsed, List <Line> Lines)
        {
            LPSED = lpsed;
            InitializeComponent();
            Names.Add(Lines[0].Name);

            foreach (Sub sb in Lines[0])
            {
                Names.Add(sb.Name);
            }
            foreach (Line li in Lines)
            {
                ObservableCollection <string> strs = new ObservableCollection <string>();
                strs.Add(li.Info);
                foreach (Sub sb in li)
                {
                    strs.Add(sb.Info);
                }
                SubList.Add(strs);
            }

            for (int i = 0; i < Names.Count; i++)
            {
                dataTable.Columns.Add(new DataGridTextColumn()
                {
                    Header = Names[i], Binding = new Binding($"[{i}]"), Foreground = (Brush)Application.Current.Resources.MergedDictionaries.Last()["LineName"]
                });
            }
            dataTable.ItemsSource = SubList;
        }
Esempio n. 2
0
        public void OpenNewLPS()
        {
            Editor ed = new LPSEditor("新建LPS文档", new LpsDocument(":|"));

            Editors.Add(ed);
            int idx = TabControlMain.Items.Add(ed.Father);

            TabControlMain.Dispatcher.BeginInvoke(new Action(() => { TabControlMain.SelectedIndex = idx; }));
            ed.FileNameChage = new Action(() => Dispatcher.BeginInvoke(new Action(() => HeaderText.Header = ((TabItem)TabControlMain.SelectedItem).Header)));
        }
Esempio n. 3
0
 public EditorLine(LPSEditor lpsed)
 {
     LPSED = lpsed;
     InitializeComponent();
     SubsWrap.Children.Add(new EditorSub(this, true));
     Text    = "Text";
     Comment = "Comment";
     DisplayReadText();
     DisplayReadComment();
 }
Esempio n. 4
0
 public EditorLine(LPSEditor lpsed, Line line)
 {
     LPSED = lpsed;
     InitializeComponent();
     SubsWrap.Children.Add(new EditorSub(this, new Sub(line.Name, line.Info), true));
     foreach (Sub sub in line.Subs)
     {
         SubsWrap.Children.Add(new EditorSub(this, sub));
     }
     Text    = line.Text;
     Comment = line.Comments;
     DisplayReadText();
     DisplayReadComment();
 }
Esempio n. 5
0
        public void OpenFile(string Path)
        {
            //如果是已经打开过的文件,跳转到那个文件
            Editor ed = Editors.Find(x => x.FilePath.ToLower() == Path.ToLower());

            if (ed == null)
            {
                LpsDocument lps = new LpsDocument(File.ReadAllText(Path));
                ed = new LPSEditor(Path, lps);
                Editors.Add(ed);
                int idx = TabControlMain.Items.Add(ed.Father);
                TabControlMain.Dispatcher.BeginInvoke(new Action(() => { TabControlMain.SelectedIndex = idx; }));
                ed.FileNameChage = new Action(() => Dispatcher.BeginInvoke(new Action(() => HeaderText.Header = ((TabItem)TabControlMain.SelectedItem).Header)));
            }
            else
            {
                TabControlMain.Dispatcher.BeginInvoke(new Action(() => { TabControlMain.SelectedIndex = Editors.IndexOf(ed) + 1; }));
            }
        }
Esempio n. 6
0
 public ToolBox(LPSEditor lpse)
 {
     InitializeComponent();
     HideInput();
     lpsed = lpse;
 }