Commands


Author
Message
Dieter Schulten
Dieter Schulten
Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)
Group: Forum Members
Posts: 10, Visits: 2
I found the answer by myself.

private NDrawingView diagramView = null;
private NDiagramCommander commander = null;

diagramView = new NDrawingView ()
commander = new NDiagramCommander ()

commander.View = diagramView;


...

If i now want to put a "ZoomIn Button" on my GUI, i just send the command
to the diagram in my OnClick for my Button:


public void ZoomIn()
{
NZoomInCommand command = new NZoomInCommand();
commander.Commands.Add(command);
command.Execute();
}

The good is, all the Undo and Redo functions built in the diagram component works as well.

Some more Wrapper-Methods i build:


public void ZoomTo(ushort percent)
{
NZoomPercentCommand command = new NZoomPercentCommand();
commander.Commands.Add(command);
command.Execute(percent.ToString());
}


public void ZoomWidth()
{
NZoomPercentCommand command = new NZoomPercentCommand();
commander.Commands.Add(command);
command.Execute("Width");
}


public void ZoomHeight()
{
NZoomPercentCommand command = new NZoomPercentCommand();
commander.Commands.Add(command);
command.Execute("Height");
}

public void ZoomFit()
{
NZoomPercentCommand command = new NZoomPercentCommand();
commander.Commands.Add(command);
command.Execute("Fit");
}

public void Undo()
{
NUndoCommand command = new NUndoCommand();
commander.Commands.Add(command);
command.Execute();
}

public void Redo()
{
NRedoCommand command = new NRedoCommand();
commander.Commands.Add(command);
command.Execute();
}

public void AlignRight()
{
NAlignRightsCommand command = new NAlignRightsCommand();
commander.Commands.Add(command);
command.Execute();
}

And so on ...

Kind Regards, Dieter







Dieter Schulten
Dieter Schulten
Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)
Group: Forum Members
Posts: 10, Visits: 2
I want to programmatically do all commands without your command bar,
but i don't want to use your command bar. We are using other
GUI controls.

I am searching for something like this:

NZoomInCommand command = new NZoomInCommand();
myDigram.Commands.Execute(command);

Sorry i can not find it in your documentation or sample application.

Kind Regards, Dieter
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search