Skip to content

Unify namespaces and class names under DemoConsole #13433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
global using System.ComponentModel;
global using System.ComponentModel.Design;
global using System.Windows.Forms.Design;
global using DesignSurfaceExt;
global using DemoConsole;
global using Timer = System.Windows.Forms.Timer;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions src/test/integration/DesignSurface/DemoConsole/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace TestConsole;

[DesignerCategory("Default")]
public partial class MainForm : Form
{
private ISelectionService _selectionService;

private readonly List<IDesignSurfaceExt> _listOfDesignSurface = [];
private readonly List<IDesignSurfaceExtended> _listOfDesignSurface = [];

public MainForm()
{
Expand Down Expand Up @@ -38,7 +37,7 @@ private void InitFormDesigner()
// - enable the UndoEngines
for (int i = 0; i < tabControl1.TabCount; i++)
{
IDesignSurfaceExt isurf = _listOfDesignSurface[i];
IDesignSurfaceExtended isurf = _listOfDesignSurface[i];
isurf.GetUndoEngineExt().Enabled = true;
}

Expand All @@ -47,7 +46,7 @@ private void InitFormDesigner()
// - if we obtain it then hook the SelectionChanged event
for (int i = 0; i < tabControl1.TabCount; i++)
{
IDesignSurfaceExt isurf = _listOfDesignSurface[i];
IDesignSurfaceExtended isurf = _listOfDesignSurface[i];
_selectionService = (ISelectionService)(isurf.GetIDesignerHost().GetService(typeof(ISelectionService)));
if (_selectionService is not null)
_selectionService.SelectionChanged += OnSelectionChanged;
Expand All @@ -60,7 +59,7 @@ private void OnSelectionChanged(object sender, EventArgs e)
if (_selectionService is null)
return;

IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
if (isurf is not null)
{
ISelectionService selectionService = isurf.GetIDesignerHost().GetService(typeof(ISelectionService)) as ISelectionService;
Expand All @@ -72,7 +71,7 @@ private void CreateDesignSurface(int n)
{
// - step.0
// - create a DesignSurface and put it inside a Form in DesignTime
DesignSurfaceExt.DesignSurfaceExt surface = new();
DesignSurfaceExtended surface = new();
// -
// -
// - store for later use
Expand Down Expand Up @@ -442,7 +441,7 @@ private void CreateDesignSurface(int n)
private void SelectRootComponent()
{
// - find out the DesignSurfaceExt control hosted by the TabPage
IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
if (isurf is not null)
{
splitContainer.Panel2.Controls.Remove(propertyGrid);
Expand All @@ -465,13 +464,13 @@ private void SelectRootComponent()

private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
isurf?.GetUndoEngineExt().Undo();
}

private void redoToolStripMenuItem_Click(object sender, EventArgs e)
{
IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
isurf?.GetUndoEngineExt().Redo();
}

Expand All @@ -483,7 +482,7 @@ private void OnAbout(object sender, EventArgs e)
private void toolStripMenuItemTabOrder_Click(object sender, EventArgs e)
{
// - find out the DesignSurfaceExt control hosted by the TabPage
IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
isurf?.SwitchTabOrder();
}

Expand All @@ -504,7 +503,7 @@ private void OnTabPageSelected(object sender, TabControlEventArgs e)

private void OnMenuClick(object sender, EventArgs e)
{
IDesignSurfaceExt isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
IDesignSurfaceExtended isurf = _listOfDesignSurface[tabControl1.SelectedIndex];
isurf?.DoAction((sender as ToolStripMenuItem).Text);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

public class DesignSurfaceExt : DesignSurface, IDesignSurfaceExt
public class DesignSurfaceExtended : DesignSurface, IDesignSurfaceExtended
{
private const string Name = "DesignSurfaceExt";

Expand Down Expand Up @@ -73,7 +73,7 @@ public void UseNoGuides()
serviceProvider.AddService(typeof(DesignerOptionService), opsService2);
}

public UndoEngineExt GetUndoEngineExt()
public UndoEngineExtended GetUndoEngineExt()
{
return _undoEngine;
}
Expand Down Expand Up @@ -270,15 +270,15 @@ public void DisposeTabOrder()

#region UndoEngine

private UndoEngineExt _undoEngine;
private NameCreationServiceImp _nameCreationService;
private DesignerSerializationServiceImpl _designerSerializationService;
private UndoEngineExtended _undoEngine;
private NameCreationService _nameCreationService;
private DesignerSerializationService _designerSerializationService;
private CodeDomComponentSerializationService _codeDomComponentSerializationService;

#endregion

// - ctor
public DesignSurfaceExt()
public DesignSurfaceExtended()
{
InitServices();
}
Expand All @@ -300,7 +300,7 @@ private void InitServices()
// - otherwise the root component did not have a name and this caused
// - troubles when we try to use the UndoEngine
// - 1. NameCreationService
_nameCreationService = new NameCreationServiceImp();
_nameCreationService = new NameCreationService();
ServiceContainer.RemoveService(typeof(INameCreationService), false);
ServiceContainer.AddService(typeof(INameCreationService), _nameCreationService);

Expand All @@ -310,12 +310,12 @@ private void InitServices()
ServiceContainer.AddService(typeof(ComponentSerializationService), _codeDomComponentSerializationService);

// - 3. IDesignerSerializationService
_designerSerializationService = new DesignerSerializationServiceImpl(ServiceContainer);
_designerSerializationService = new DesignerSerializationService(ServiceContainer);
ServiceContainer.RemoveService(typeof(IDesignerSerializationService), false);
ServiceContainer.AddService(typeof(IDesignerSerializationService), _designerSerializationService);

// - 4. UndoEngine
_undoEngine = new UndoEngineExt(ServiceContainer)
_undoEngine = new UndoEngineExtended(ServiceContainer)
{
// Disable the UndoEngine
Enabled = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

internal class DesignerOptionServiceBase : DesignerOptionService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

internal sealed class DesignerSerializationServiceImpl : IDesignerSerializationService
internal sealed class DesignerSerializationService : IDesignerSerializationService
{
private readonly IServiceProvider _serviceProvider;

public DesignerSerializationServiceImpl(IServiceProvider serviceProvider)
public DesignerSerializationService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

public interface IDesignSurfaceExt
public interface IDesignSurfaceExtended
{
// - perform Cut/Copy/Paste/Delete commands
void DoAction(string command);
Expand All @@ -25,7 +25,7 @@ TControl CreateControl<TControl>(Size controlSize, Point controlLocation)
where TControl : Control;

// - Get the UndoEngineExtended object
UndoEngineExt GetUndoEngineExt();
UndoEngineExtended GetUndoEngineExt();

// - Get the IDesignerHost of the .NET 2.0 DesignSurface
IDesignerHost GetIDesignerHost();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

/// <summary>
/// Implements <see cref="INameCreationService"/> to provide names for newly created controls.
Expand All @@ -13,7 +13,7 @@ namespace DesignSurfaceExt;
/// it increments an integer counter until it finds a unique name that is not already in use.
/// </para>
/// </remarks>
internal sealed class NameCreationServiceImp : INameCreationService
internal sealed class NameCreationService : INameCreationService
{
public string CreateName(IContainer container, Type type)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

[DesignerCategory("Default")]
public class PropertyGridExt : PropertyGrid
public class PropertyGridExtended : PropertyGrid
{
private IDesignerHost _host;
private IComponentChangeService _componentChangeService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

public class TabOrderHooker
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace DesignSurfaceExt;
namespace DemoConsole;

public class UndoEngineExt : UndoEngine
public class UndoEngineExtended : UndoEngine
{
private readonly Stack<UndoUnit> _undoStack = new();
private readonly Stack<UndoUnit> _redoStack = new();

public UndoEngineExt(IServiceProvider provider) : base(provider) { }
public UndoEngineExtended(IServiceProvider provider) : base(provider) { }

public bool EnableUndo
{
Expand Down