diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj
index 06e332f6ca..7e454a0b84 100644
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj
+++ b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj
@@ -46,7 +46,6 @@
-
4.0
@@ -70,19 +69,12 @@
-
- SettingsView.cs
-
-
-
- SettingsView.cs
-
-
- SettingsViewXaml.xaml
+
+ SettingsView.xaml
Code
@@ -111,7 +103,7 @@
-
+
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.Designer.cs b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.Designer.cs
deleted file mode 100644
index e1ad3b4d7c..0000000000
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.Designer.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
-// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
-
-namespace ICSharpCode.SettingsEditor
-{
- partial class SettingsView
- {
- ///
- /// Designer variable used to keep track of non-visual components.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Disposes resources used by the control.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing) {
- if (components != null) {
- components.Dispose();
- }
- }
- base.Dispose(disposing);
- }
-
- ///
- /// This method is required for Windows Forms designer support.
- /// Do not change the method contents inside the source code editor. The Forms designer might
- /// not be able to load this method if it was changed manually.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.grid = new System.Windows.Forms.DataGridView();
- this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.TypeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
- this.ScopeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
- this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
- ((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
- this.SuspendLayout();
- //
- // grid
- //
- this.grid.AutoGenerateColumns = false;
- this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.NameColumn,
- this.TypeColumn,
- this.ScopeColumn,
- this.ValueColumn});
- this.grid.DataSource = this.bindingSource;
- this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
- this.grid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke;
- this.grid.Location = new System.Drawing.Point(0, 0);
- this.grid.Name = "grid";
- this.grid.Size = new System.Drawing.Size(486, 362);
- this.grid.TabIndex = 0;
- this.grid.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.GridDataError);
- this.grid.SelectionChanged += new System.EventHandler(this.GridSelectionChanged);
- this.grid.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.GridUserDeletingRow);
- //
- // NameColumn
- //
- this.NameColumn.DataPropertyName = "Name";
- this.NameColumn.HeaderText = "Name";
- this.NameColumn.MinimumWidth = 50;
- this.NameColumn.Name = "NameColumn";
- //
- // TypeColumn
- //
- this.TypeColumn.DataPropertyName = "WrappedSettingType";
- this.TypeColumn.DropDownWidth = 255;
- this.TypeColumn.HeaderText = "Type";
- this.TypeColumn.MinimumWidth = 50;
- this.TypeColumn.Name = "TypeColumn";
- this.TypeColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
- //
- // ScopeColumn
- //
- this.ScopeColumn.DataPropertyName = "Scope";
- this.ScopeColumn.DropDownWidth = 80;
- this.ScopeColumn.HeaderText = "Scope";
- this.ScopeColumn.MinimumWidth = 30;
- this.ScopeColumn.Name = "ScopeColumn";
- this.ScopeColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
- //
- // ValueColumn
- //
- this.ValueColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.ValueColumn.DataPropertyName = "SerializedValue";
- this.ValueColumn.HeaderText = "Value";
- this.ValueColumn.MinimumWidth = 50;
- this.ValueColumn.Name = "ValueColumn";
- //
- // bindingSource
- //
- this.bindingSource.DataSource = typeof(ICSharpCode.SettingsEditor.SettingsEntry);
- this.bindingSource.AddingNew += new System.ComponentModel.AddingNewEventHandler(this.BindingSourceAddingNew);
- //
- // SettingsView
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.grid);
- this.Name = "SettingsView";
- this.Size = new System.Drawing.Size(486, 362);
- ((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit();
- this.ResumeLayout(false);
- }
- private System.Windows.Forms.DataGridViewComboBoxColumn TypeColumn;
- private System.Windows.Forms.DataGridViewComboBoxColumn ScopeColumn;
- private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
- private System.Windows.Forms.DataGridViewTextBoxColumn NameColumn;
- private System.Windows.Forms.BindingSource bindingSource;
- private System.Windows.Forms.DataGridView grid;
- }
-}
diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.cs b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.cs
deleted file mode 100644
index fed206380a..0000000000
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
-// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.TypeSystem;
-using ICSharpCode.NRefactory.TypeSystem.Implementation;
-using ICSharpCode.SharpDevelop.Gui;
-using ICSharpCode.Core;
-using ICSharpCode.SharpDevelop.Dom;
-using ICSharpCode.SharpDevelop;
-
-namespace ICSharpCode.SettingsEditor
-{
- public partial class SettingsView : UserControl, ISettingsEntryHost
- {
- public event EventHandler SelectionChanged;
- public event EventHandler SettingsChanged;
-
- static readonly Type[] defaultAvailableTypes = new Type[] {
- typeof(bool),
- typeof(byte),
- typeof(char),
- typeof(decimal),
- typeof(double),
- typeof(float),
- typeof(int),
- typeof(long),
- typeof(sbyte),
- typeof(short),
- typeof(string),
- typeof(System.Collections.Specialized.StringCollection),
- typeof(System.DateTime),
- typeof(System.Drawing.Color),
- typeof(System.Drawing.Font),
- typeof(System.Drawing.Point),
- typeof(System.Drawing.Size),
- typeof(System.Guid),
- typeof(System.TimeSpan),
- typeof(uint),
- typeof(ulong),
- typeof(ushort)
- };
-
- List typeNames = new List();
- List types = new List();
- IAmbience ambience;
- ICompilation compilation;
-
- public SettingsView()
- {
- InitializeComponent();
-
- ambience = AmbienceService.GetCurrentAmbience();
- compilation = MinimalCorlib.Instance.CreateCompilation();
-
- foreach (Type type in defaultAvailableTypes) {
- types.Add(type);
- typeNames.Add(ambience.ConvertType(type.ToTypeReference().Resolve(compilation)));
- }
- foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
- types.Add(d.type);
- typeNames.Add(d.name);
- }
-
- ScopeColumn.DataSource = Enum.GetValues(typeof(SettingScope));
- TypeColumn.DataSource = typeNames;
- }
-
- public void ShowEntries(IList list)
- {
- bindingSource.Clear();
- foreach (SettingsEntry entry in list) {
- bindingSource.Add(entry);
- }
- bindingSource.ListChanged += delegate(object sender, ListChangedEventArgs e) {
- if (e.NewIndex >= 0 && e.NewIndex < bindingSource.Count) {
- if (((SettingsEntry)bindingSource[e.NewIndex]).Name != null) {
- OnSettingsChanged(e);
- }
- }
- };
- }
-
- void GridSelectionChanged(object sender, EventArgs e)
- {
- if (SelectionChanged != null)
- SelectionChanged(this, e);
- }
-
- public IEnumerable GetAllEntries()
- {
- List l = new List();
- foreach (SettingsEntry entry in bindingSource) {
- if (!string.IsNullOrEmpty(entry.Name)) {
- l.Add(entry);
- }
- }
- l.Sort(delegate(SettingsEntry a, SettingsEntry b) {
- return a.Name.CompareTo(b.Name);
- });
- return l;
- }
-
- public List GetSelectedEntriesForPropertyGrid()
- {
- List l
- = new List();
- if (grid.SelectedRows.Count > 0) {
- foreach (DataGridViewRow row in grid.SelectedRows) {
- if (row.DataBoundItem != null) {
- l.Add(new SettingsEntryPropertyGridWrapper((SettingsEntry)row.DataBoundItem));
- }
- }
- } else {
- bool[] rowAdded = new bool[grid.Rows.Count];
- foreach (DataGridViewCell cell in grid.SelectedCells) {
- if (rowAdded[cell.RowIndex] == false) {
- rowAdded[cell.RowIndex] = true;
- if (cell.OwningRow.DataBoundItem != null) {
- l.Add(new SettingsEntryPropertyGridWrapper((SettingsEntry)cell.OwningRow.DataBoundItem));
- }
- }
- }
- }
- return l;
- }
-
- void BindingSourceAddingNew(object sender, AddingNewEventArgs e)
- {
- SettingsEntry entry = new SettingsEntry(this);
- entry.Type = typeof(string);
- e.NewObject = entry;
- }
-
- void GridDataError(object sender, DataGridViewDataErrorEventArgs e)
- {
- LoggingService.Debug("Row " + e.RowIndex + ", column " + e.ColumnIndex + ", error " + e.Exception.ToString());
- if (e.Exception != null) {
- MessageBox.Show("Error in data entry: " + e.Exception.Message);
- } else {
- MessageBox.Show("Error in data entry");
- }
- }
-
- string ISettingsEntryHost.GetDisplayNameForType(Type type)
- {
- foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
- if (type == d.type)
- return d.name;
- }
- return ambience.ConvertType(type.ToTypeReference().Resolve(compilation));
- }
-
- Type ISettingsEntryHost.GetTypeByDisplayName(string displayName)
- {
- for (int i = 0; i < typeNames.Count; i++) {
- if (typeNames[i] == displayName)
- return types[i];
- }
- return null;
- }
-
- void GridUserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
- {
- if (e.Row != null && !e.Cancel) {
- OnSettingsChanged(EventArgs.Empty);
- }
- }
-
- protected virtual void OnSettingsChanged(EventArgs e)
- {
- if (SettingsChanged != null) {
- SettingsChanged(this, e);
- }
- }
- }
-}
diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.resx b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.resx
deleted file mode 100644
index 186f9f6019..0000000000
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.resx
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- True
-
-
-
- 28, 18
-
-
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewXaml.xaml b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.xaml
similarity index 97%
rename from src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewXaml.xaml
rename to src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.xaml
index d107534e3f..a85631658b 100644
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewXaml.xaml
+++ b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.xaml
@@ -1,6 +1,6 @@
/// Interaction logic for SettingsViewXaml.xaml
///
- public partial class SettingsViewXaml : UserControl,ISettingsEntryHost
+ public partial class SettingsView : UserControl,ISettingsEntryHost
{
public event EventHandler SettingsChanged;
public event EventHandler SelectionChanged;
@@ -65,7 +58,7 @@ namespace ICSharpCode.SettingsEditor
IAmbience ambience;
ICompilation compilation;
- public SettingsViewXaml()
+ public SettingsView()
{
InitializeComponent();
diff --git a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs
index 09c58d15c1..3b64f09f69 100644
--- a/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs
+++ b/src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs
@@ -19,8 +19,7 @@ namespace ICSharpCode.SettingsEditor
{
public class SettingsViewContent : AbstractViewContentHandlingLoadErrors, IHasPropertyContainer
{
-// SettingsView view = new SettingsView();
- SettingsViewXaml view = new SettingsViewXaml();
+ SettingsView view = new SettingsView();
PropertyContainer propertyContainer = new PropertyContainer();
SettingsDocument setDoc = new SettingsDocument();
MemoryStream appConfigStream;
@@ -29,30 +28,17 @@ namespace ICSharpCode.SettingsEditor
public SettingsViewContent(OpenedFile file) : base(file)
{
TryOpenAppConfig(false);
- /*
- view.SelectionChanged += delegate {
- propertyContainer.SelectedObjects = view.GetSelectedEntriesForPropertyGrid().ToArray();
- };
- view.SettingsChanged += delegate {
- if (this.PrimaryFile != null)
- this.PrimaryFile.MakeDirty();
- if (appConfigFile != null)
- appConfigFile.MakeDirty();
- };
- */
-
+
this.UserContent = view;
view.SelectionChanged += ((s,e) =>
{
- Console.WriteLine("SettingsViewContent.SelectionChanged");
propertyContainer.SelectedObjects = view.GetSelectedEntriesForPropertyGrid().ToArray();
});
view.SettingsChanged += ((s,e) =>
{
- Console.WriteLine("SettingsViewContent.SettingsChanged");
if (this.PrimaryFile != null)
this.PrimaryFile.MakeDirty();
if (appConfigFile != null)
@@ -61,6 +47,7 @@ namespace ICSharpCode.SettingsEditor
}
+
void TryOpenAppConfig(bool createIfNotExists)
{
if (appConfigFile != null) // already open
@@ -80,6 +67,7 @@ namespace ICSharpCode.SettingsEditor
}
}
+
protected override void LoadInternal(OpenedFile file, Stream stream)
{
Console.WriteLine ("LoadInternal");
@@ -101,6 +89,7 @@ namespace ICSharpCode.SettingsEditor
}
+
void ShowLoadError(string message)
{
MessageService.ShowMessage(message);