예제 #1
0
        static void Main(string[] args)
        {
            var state = new State
            {
                TheCurser = new Cursor(new Coord(10, 10))
            };

            var man       = new WindowManager("AsciiUML (c) Kasper B. Graversen 2016-");
            var topmenu   = new TopMenu(man, state);
            var umlWindow = new UmlWindow(topmenu, state);

            //var umlWindow = new UmlWindow(topmenu, TempModelForPlayingAround(state));
            umlWindow.Focus();
            //ShowLogo(umlWindow);

            var title = new TitledWindow(umlWindow, "Connect objects");
            var f     = new ConnectForm(title, new Coord(5, 5));

            f.Focus();
            man.Start();
        }
예제 #2
0
        private static void ConnectObjects(State state, UmlWindow umlWindow)
        {
            state.PaintSelectableIds = true;

            var cmds = NoopForceRepaint;

            var connect = new ConnectForm(umlWindow, state.TheCurser.Pos, state.Model.Objects.Select(x => x.Id).ToArray())
            {
                OnCancel = () => {
                    umlWindow.HandleCommands(cmds);
                    state.PaintSelectableIds = false;
                },
                OnSubmit = (from, to) => {
                    cmds.Add(new CreateLine(from, to, LineKind.Connected));
                    umlWindow.HandleCommands(cmds);
                    state.PaintSelectableIds = false;
                }
            };

            connect.Focus();
        }