Пример #1
0
        public SelectDialog(IVertex info, IVertex options, Point?position)
        {
            if (options.Count() > 1)
            {
                InitializeComponent();

                if (position != null)
                {
                    _mousePosition = (Point)position;
                    this.Loaded   += new RoutedEventHandler(OnLoad);
                }
                else
                {
                    Owner = m0Main.Instance;
                }

                Info.Content = info.Value;

                List.ItemsSource = options;

                ShowDialog();
            }
            else
            {
                IEdge e = options.FirstOrDefault();

                if (e != null)
                {
                    SelectedOption = e.To;
                }
            }
        }
Пример #2
0
        private void FillNewVertexAndEdgeBySchemaMenu()
        {
            IVertex baseVertex = Edge.Get(@"To:");

            IVertex r = baseVertex.GetAll(@"$Is:");

            if (r.Count() == 0)
            {
                r = Edge.GetAll(@"Meta:");
            }
            ;

            if (r.Count() == 0 || r.FirstOrDefault().To.Value == null || GeneralUtil.CompareStrings(r.FirstOrDefault().To.Value, "$Empty"))
            {
                NewVertexBySchema.IsEnabled = false;
                NewEdgeBySchema.IsEnabled   = false;
                return;
            }

            NewVertexBySchema.Items.Clear();
            NewEdgeBySchema.Items.Clear();

            foreach (IEdge e in r)
            {
                NewVertexAndEdgeBySchema_FillForMeta(baseVertex, e.To, VertexOperations.GetChildEdges(e.To));
            }

            NewVertexAndEdgeBySchema_FillForMeta(baseVertex, MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"), MinusZero.Instance.Root.GetAll(@"System\Meta\Base\Vertex\"));

            NewVertexBySchema.IsEnabled = true;
            NewEdgeBySchema.IsEnabled   = true;
        }
Пример #3
0
        public static void DoDropForVertexVisualiser(object orgin, IVertex baseEdge, DragEventArgs e)
        {
            IVertex r = MinusZero.Instance.Root;

            object sender = e.Data.GetData("DragSource");

            if (sender == null || orgin == sender)
            {
                return;
            }

            if (e.Data.GetDataPresent("Vertex"))
            {
                IVertex dndVertex = e.Data.GetData("Vertex") as IVertex;

                IEdge ee = dndVertex.FirstOrDefault();

                if (ee != null)
                {
                    IVertex toMeta = r.Get(@"System\Meta\ZeroTypes\Edge\To");
                    GraphUtil.CreateOrReplaceEdge(baseEdge.Get("From:"), baseEdge.Get("Meta:"), ee.To.Get("To:"));
                    GraphUtil.CreateOrReplaceEdge(baseEdge, toMeta, ee.To.Get("To:")); // this is needed for some update scenarios
                }


                if (sender is IHasSelectableEdges)
                {
                    ((IHasSelectableEdges)sender).UnselectAllSelectedEdges();
                }

                GraphUtil.RemoveAllEdges(dndVertex);
            }

            MinusZero.Instance.IsGUIDragging = false;
        }
Пример #4
0
        protected override void UpdateBaseEdge()
        {
            IVertex bas = Vertex.Get(@"BaseEdge:\To:");

            if (bas != null)
            {
                ToShowEdgesMeta = null;

                if (Vertex.Get(@"ToShowEdgesMeta:\Meta:") != null)
                {
                    ToShowEdgesMeta = Vertex.Get(@"ToShowEdgesMeta:\Meta:");
                }

                if (ToShowEdgesMeta == null) // take first edge from BaseEdge\To, to have Meta as ToShowEdesMeta:\Meta:==null
                {
                    IEdge e = bas.FirstOrDefault();

                    if (e != null)
                    {
                        ToShowEdgesMeta = e.Meta;

                        VertexChangeListenOff();

                        Edge.AddEdgeEdges(Vertex.Get(@"ToShowEdgesMeta:"), e);

                        VertexChangeListenOn();
                    }
                }

                if (ToShowEdgesMeta != null)
                {
                    ((EasyVertex)Vertex.Get(@"FilterQuery:")).CanFireChangeEvent = false;

                    Vertex.Get(@"FilterQuery:").Value = ToShowEdgesMeta.Value + ":";

                    ((EasyVertex)Vertex.Get(@"FilterQuery:")).CanFireChangeEvent = true;
                }


                if (Vertex.Get(@"FilterQuery:") != null && Vertex.Get(@"FilterQuery:").Value != null) // do the filtering
                {
                    IVertex data = VertexOperations.DoFilter(bas, Vertex.Get(@"FilterQuery:"));

                    if (data != null)
                    {
                        ThisDataGrid.ItemsSource = data.ToList();
                    }
                    else
                    {
                        ThisDataGrid.ItemsSource = null;
                    }
                }
                else
                {
                    ThisDataGrid.ItemsSource = bas.ToList(); // if there is no .ToList DataGrid can not edit
                }
                if (GraphUtil.GetValueAndCompareStrings(Vertex.Get("ExpertMode:"), "True"))
                {
                    ExpertMode = true;
                }
                else
                {
                    ExpertMode = false;
                }

                ResetView();
            }
        }