Beispiel #1
0
        public searchTool()
        {
            InitializeComponent();
            var viewModel = new searchTool_ModelView();

            this.DataContext = viewModel;

            viewModel.NewToolRequested += (s, a) =>
            {
                NewTool newToolWindow = new NewTool();
                newToolViewModel = newToolWindow.DataContext as NewTool_ViewModel;
                newToolViewModel.ToolInserted += (so, ar) =>
                {
                    viewModel.selectedTool = so as ToolRepresentation;
                    viewModel.OnToolSelected();
                    newToolWindow.Close();
                };
                newToolWindow.Show();
            };
        }
Beispiel #2
0
        private void BuildSearchToolWindow()
        {
            if (toolPickerUC == null)
            {
                toolPickerUC  = new searchTool();
                toolPicker_VM = toolPickerUC.DataContext as searchTool_ModelView;
            }

            toolPickerWindow = new Window()
            {
                Content       = toolPickerUC,
                Title         = "Gép választó",
                SizeToContent = SizeToContent.WidthAndHeight
            };

            toolPicker_VM.ToolSelected += (s, a) =>
            {
                ToolRepresentation tool = s as ToolRepresentation;
                tool.ValidationRules   = new ToolValidationRules();
                viewModel.selectedTool = tool;
                toolPickerWindow.Hide();
            };
        }