SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
IniEditor.xaml.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Data;
8 using System.Windows.Documents;
9 using System.Windows.Input;
10 using System.Windows.Media;
11 using System.Windows.Media.Imaging;
12 using System.Windows.Navigation;
13 using System.Windows.Shapes;
14 
15 namespace SeciControls
16 {
20  public partial class IniEditor : UserControl
21  {
22  List<String> _files = new List<string>();
23 
24  public IniEditor()
25  {
26  InitializeComponent();
27  }
28 
29  public void ClearFiles()
30  {
31  tcFiles.Items.Clear();
32  _files.Clear();
33  }
34 
35  public void LoadFiles(List<String> files)
36  {
37  foreach (String file in files)
38  {
39  if (!_files.Contains(file.ToLower()))
40  {
41  int index = tcFiles.Items.Add(new EditTab(file));
42  tcFiles.SelectedIndex = index;
43  _files.Add(file.ToLower());
44  }
45  }
46  }
47 
48  private void SaveExecuted(object sender, ExecutedRoutedEventArgs e)
49  {
50  EditTab tab = tcFiles.SelectedItem as EditTab;
51 
52  if (tab != null)
53  {
54  if (tab.Filename != "")
55  {
56  try
57  {
58  //Save it
59  tab.SaveText(tab.Filename);
60  txtMessages.Text = "";
61  }
62  catch (Exception err)
63  {
64  txtMessages.Text = "Could not save " + tab.Filename + ": " + err.Message;
65  }
66  }
67  }
68  }
69 
70  private void btnRevert_Click(object sender, RoutedEventArgs e)
71  {
72  EditTab tab = tcFiles.SelectedItem as EditTab;
73 
74  if (tab != null)
75  {
76  if (tab.Filename != "")
77  {
78  try
79  {
80  txtMessages.Text = "";
81 
82  //This asks Seci to restore the file saved as part of the configuration
83  Seci.Managers.AssocFileMgr.RestoreFile(tab.Filename);
84  //Then we load it
85  tab.ReloadFile();
86  }
87  catch (Exception err)
88  {
89  txtMessages.Text = "Could not reload original version of" + tab.Filename + ": " + err.Message;
90  }
91  }
92  }
93  }
94  }
95 }
void LoadFiles(List< String > files)
void btnRevert_Click(object sender, RoutedEventArgs e)
List< String > _files
void SaveExecuted(object sender, ExecutedRoutedEventArgs e)
Interaction logic for IniEditor.xaml