コード例 #1
0
        private void init()
        {
            // setup the boxes

            listBoxBoxes.DataContext = BoxManager.Instance.CurrentLayout;


            // setup the assemblyzones
            listBoxAssemblyZones.DataContext = AssemblyZoneManager.Instance.CurrentLayout;


            // setup the objects
            m_listBoxObjectZones.DataContext = ObjectDetectionManager.Instance.CurrentLayout;

            // setup the networktables
            listBoxNetworkTables.DataContext = CommunicationManager.Instance.ServerInfo;

            // init the new Workflow
            if (WorkflowManager.Instance.LoadedWorkflow != null)
            {
                wasWorkflowLoaded = true;
                Workflow obj = new Workflow();
                UtilitiesCopy.DeepClone <Workflow>(ref obj, WorkflowManager.Instance.LoadedWorkflow);
                EditWorkflowManager.Instance.CurrentWorkflow = obj;
            }
            else
            {
                EditWorkflowManager.Instance.CurrentWorkflow = new Workflow();
            }

            m_WorkflowListview.DataContext = EditWorkflowManager.Instance.CurrentWorkflow;
            EditWorkflowManager.Instance.CurrentWorkflow.BoxLayout = BoxManager.Instance.CurrentLayout;
            //AssemblyZoneManager.Instance.CurrentLayout = new AssemblyZoneLayout(); // Assemblyzones are different -.-
            EditWorkflowManager.Instance.CurrentWorkflow.AssemblyZoneLayout = AssemblyZoneManager.Instance.CurrentLayout;
            EditWorkflowManager.Instance.CurrentWorkflow.ObjectZoneLayout   = ObjectDetectionManager.Instance.CurrentLayout;

            Style itemContainerStyle = new Style(typeof(ListBoxItem));

            itemContainerStyle.Setters.Add(new Setter(ListBoxItem.AllowDropProperty, true));
            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(onListViewMouseLeftButtonDown)));
            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DragEnterEvent, new DragEventHandler(onListViewDragEnter)));
            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DragLeaveEvent, new DragEventHandler(onListViewDragLeave)));
            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DragOverEvent, new DragEventHandler(onListViewDragOver)));
            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DropEvent, new DragEventHandler(onListViewDrop)));
            m_WorkflowListview.ItemContainerStyle = itemContainerStyle;

            m_ComboboxAdaptivityLevel.ItemsSource   = AdaptivityLevel.AdaptivityLevels;
            m_ComboboxAdaptivityLevel.SelectedValue = SettingsManager.Instance.Settings.AdaptivityLevelId;


            AdminView.Instance.refreshDataContext();
            AdminView.Instance.refreshWorkflowUI();
        }
コード例 #2
0
        private void applyLayout_Click(object sender, RoutedEventArgs e)
        {
            Workflow obj = new Workflow();

            UtilitiesCopy.DeepClone <Workflow>(ref obj, EditWorkflowManager.Instance.CurrentWorkflow);
            WorkflowManager.Instance.LoadedWorkflow = obj;

            AdminView.Instance.refreshDataContext();
            AdminView.Instance.refreshWorkflowUI();

            if (m_WorkflowListview.HasItems)
            {
                StateManager.Instance.SetNewState(WorkflowManager.Instance, AllEnums.State.WORKFLOW_LOADED);
            }
        }