Beispiel #1
0
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            _view = new WPFGraphView(canvas1);
            _view.OnCommandChanged += new CommandChangedEventHandler(View_OnCommandChanged);
            _view.OnSelectionChanged += new touchvg.view.SelectionChangedEventHandler(View_OnSelectionChanged);

            List<KeyValuePair<string, string>> commandSource = new List<KeyValuePair<string, string>>();
            for (int i = 0; i < _commands.Length; i += 2)
            {
                commandSource.Add(new KeyValuePair<string, string>(_commands[i], _commands[i + 1]));
            }
            this.cboCmd.DisplayMemberPath = "Key";
            this.cboCmd.SelectedValuePath = "Value";
            this.cboCmd.ItemsSource = commandSource;
            this.cboCmd.SelectedIndex = 0;

            List<KeyValuePair<string, string>> lineStyleSource = new List<KeyValuePair<string, string>>();
            for (int i = 0; i < _lineStyles.Length; i += 2)
            {
                lineStyleSource.Add(new KeyValuePair<string, string>(_lineStyles[i], _lineStyles[i + 1]));
            }
            this.cboLineStyle.DisplayMemberPath = "Key";
            this.cboLineStyle.SelectedValuePath = "Value";
            this.cboLineStyle.ItemsSource = lineStyleSource;
            this.cboLineStyle.SelectedIndex = 0;

            _helper = new WPFViewHelper(_view);
            DemoCmds.registerCmds(_helper.CmdViewHandle());
            _helper.Load("C:\\Test\\page.vg");
            _helper.StartUndoRecord("C:\\Test\\undo");
            _helper.Command = "select";
        }