private void SetStatesGallery()
        {
            States = bizState.GetStates(ProcessID, false);
            // AddStartAndEndStates();
            var stateGallery = GalleryTree.FirstOrDefault(x => x.Header == "حالات");

            if (stateGallery == null)
            {
                stateGallery = new Gallery()
                {
                    Header = "حالات"
                };
                GalleryTree.Add(stateGallery);
            }
            stateGallery.Items.Clear();
            foreach (var state in States)
            {
                //برای زمان رفرش شدن
                if (!GetDiagramStateShapes().Any(x => x.StateID == state.ID))
                {
                    var galleryItem = new GalleryItem();

                    galleryItem.Header   = state.Name;
                    galleryItem.ItemType = "State";
                    var shape = new StateShape();
                    // shape.Name = state.Name.Replace(" ", "") + state.ID.ToString();
                    if (state.StateType == StateType.Start || state.StateType == StateType.End)
                    {
                        shape.Background = new SolidColorBrush(Colors.Red);
                    }
                    shape.StateID = state.ID;

                    shape.Title = state.Name;

                    galleryItem.Shape = shape;
                    stateGallery.Items.Add(galleryItem);
                }
            }
        }
 private void View_ItemSaved3(object sender, SavedItemArg e)
 {
     dtgStates.ItemsSource = bizState.GetStates(Message.ID, false);
 }