Exemple #1
0
 public FlowLayoutAlternativeState(AlternativeState state, int index)
 {
     OldState = state.GetName();
     Color    = state.GetColor();
     Index    = index;
     Init();
 }
Exemple #2
0
 private void GenerateMenu()
 {
     changeStateMenu = ContextMenuItem.CreateAndRegister(this, StateMenuEventId, Messages.Menu_SetState);
     Enum.GetValues(typeof(AlternativeState)).Cast <AlternativeState>().ToList().ForEach(state =>
     {
         ContextMenuItem menuItem = ContextMenuItem.CreateAndRegister(this, state.GetName().ToUpper(),
                                                                      state.GetName(), true);
         menuItem.Action = () => State = state;
         menu[state]     = menuItem;
     });
 }
Exemple #3
0
        //TODO should be moved to parent (AlternativeContainer)


        public override void Repaint()
        {
            if (!Globals.RationallyAddIn.Application.IsUndoingOrRedoing)
            //undo's should not edit the shape again, visio handles that for us
            {
                UpdateReorderFunctions(Globals.RationallyAddIn.Model.Alternatives.Count - 1);
                if (Globals.RationallyAddIn.Model.Alternatives.Count > Index)
                {
                    Alternative      alternative = Globals.RationallyAddIn.Model.Alternatives[Index];
                    AlternativeState newAlternativeState;

                    if (Enum.TryParse(alternative.Status, out newAlternativeState))
                    {
                        State = newAlternativeState;
                    }
                }
            }
            base.Repaint();
        }
Exemple #4
0
        public static AlternativeStateShape CreateWithNewShape(Page page, int alternativeIndex,
                                                               AlternativeState state)
        {
            string pathToStencil = Constants.MyShapesFolder + VisioFormulas.HiddenStencil;
            Shape  shape         = CreateShapeFromStencilMaster(page, pathToStencil, VisioFormulas.AlternativeState_ShapeMaster);

            AlternativeStateShape stateShape = new AlternativeStateShape(page, shape);

            stateShape.GenerateMenu();
            stateShape.RationallyType = ShapeNames.TypeAlternativeState;
            stateShape.Index          = alternativeIndex;
            stateShape.Name           = ShapeNames.AlternativeState;

            stateShape.State = state;
            stateShape.AddAction("addAlternative", string.Format(VisioFormulas.Formula_QUEUMARKEREVENT, "add"), Messages.Menu_AddAlternative, false);
            stateShape.AddAction("deleteAlternative", string.Format(VisioFormulas.Formula_QUEUMARKEREVENT, "delete"), Messages.Menu_DeleteAlternative,
                                 false);
            stateShape.InitStyle();
            return(stateShape);
        }
Exemple #5
0
        public static string GetName(this AlternativeState state)
        {
            switch (state)
            {
            case AlternativeState.Accepted:
                return(Messages.AlternativeState_Accepted);

            case AlternativeState.Rejected:
                return(Messages.AlternativeState_Rejected);

            case AlternativeState.Challenged:
                return(Messages.AlternativeState_Challenged);

            case AlternativeState.Discarded:
                return(Messages.AlternativeState_Discarded);

            default:
            case AlternativeState.Proposed:
                return(Messages.AlternativeState_Proposed);
            }
        }
Exemple #6
0
        public static Color GetColor(this AlternativeState state)
        {
            switch (state)
            {
            case AlternativeState.Accepted:
                return(Color.FromArgb(0, 175, 0));

            case AlternativeState.Rejected:
                return(Color.FromArgb(153, 12, 0));

            case AlternativeState.Challenged:
                return(Color.FromArgb(255, 173, 21));

            case AlternativeState.Discarded:
                return(Color.FromArgb(155, 155, 155));

            default:
            case AlternativeState.Proposed:
                return(Color.FromArgb(96, 182, 215));
            }
        }