Esempio n. 1
0
        private void LoadTabPage(FileInfo fileInfo)
        {
            if (_TabPages.ContainsKey(fileInfo.FullName))
            {
                BindingList <PListDefinition> list = XmlSerializationHelper <BindingList <PListDefinition> > .ConvertFromFile(fileInfo.FullName);

                if (list != null)
                {
                    PListControl control = _TabControl.SelectedTab.Controls[0] as PListControl;
                    if (control != null)
                    {
                        control.Update(list);
                    }
                }
                else
                {
                    MessageBox.Show("Unable to load definition file " + fileInfo.FullName + ".", "Load Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                _TabControl.SelectedTab = _TabPages[fileInfo.FullName];
                return;
            }
            else
            {
                BindingList <PListDefinition> list = XmlSerializationHelper <BindingList <PListDefinition> > .ConvertFromFile(fileInfo.FullName);

                if (list != null)
                {
                    TabPage      tabPage = new TabPage(fileInfo.Name);
                    PListControl control = new PListControl(list, fileInfo, fileInfo.FullName);
                    control.Dock = DockStyle.Fill;

                    control.Saved        += new EventHandler <EventArgs>(control_Saved);
                    control.Duplicate    += new EventHandler <DuplicateEventArgs>(control_Duplicate);
                    control.CloseRequest += new EventHandler <EventArgs>(control_CloseRequest);

                    tabPage.Controls.Add(control);

                    _TabPages.Add(fileInfo.FullName, tabPage);

                    _TabControl.TabPages.Add(tabPage);
                    _TabControl.SelectedTab = tabPage;

                    SaveUserSettings();
                }
                else
                {
                    MessageBox.Show("Unable to load definition file " + fileInfo.FullName + ".", "Load Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UserSettings userSettings = XmlSerializationHelper <UserSettings> .ConvertFromFile(UserSettings.FILE_PATH);

            if (userSettings == null)
            {
                userSettings = new UserSettings();
            }

            ApplicationContext.Instance.UserSettings = userSettings;

            Application.Run(new MainForm());
        }