コード例 #1
0
        private void OnCurrentAppointmentModificationsChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            switch (propertyChangedEventArgs.PropertyName)
            {
            case nameof(AppointmentModifications.BeginTime):
            case nameof(AppointmentModifications.EndTime):
            case nameof(AppointmentModifications.CurrentLocation):
            case nameof(AppointmentModifications.Description):
            {
                currentButtonMode = currentAppointmentModifications.UndoPossible
                                                                                        ? ButtonMode.EditsAvailable
                                                                                        : ButtonMode.StartOfEditMode;
                break;
            }

            case nameof(AppointmentModifications.UndoPossible):
            {
                ((Command)Undo).RaiseCanExecuteChanged();
                break;
            }

            case nameof(AppointmentModifications.RedoPossible):
            {
                ((Command)Redo).RaiseCanExecuteChanged();
                break;
            }
            }
        }
コード例 #2
0
 public ButtonRemoved(CardGroupId cardGroupId, ButtonMode buttonMode, int zoneIndex, int index)
 {
     CardGroupId = cardGroupId;
     ButtonMode  = buttonMode;
     ZoneIndex   = zoneIndex;
     Index       = index;
 }
コード例 #3
0
ファイル: ActionGroup.cs プロジェクト: taniwha/AdvancedInput
 public AI_BB_ActionGroup(ConfigNode node)
 {
     if (node != null)
     {
         mode = ButtonMode_methods.Parse(node.GetValue("mode"));
     }
 }
コード例 #4
0
        public void SetButtonMode(ButtonMode buttonMode)
        {
            _page      = 0;
            ButtonMode = buttonMode;

            UpdateButtonToNewDynamicAction();
        }
コード例 #5
0
ファイル: Connector.cs プロジェクト: matthiasgrumet/mgst
        public void Run()
        {
            while (_connected)
            {
                try
                {
                    int theByte = _serialPort.ReadByte();
                    Console.WriteLine(theByte);

                    Button     button     = (Button)(theByte % 8);
                    ButtonMode buttonMode = theByte < 8 ? ButtonMode.Up : ButtonMode.Down;

                    Console.WriteLine($"{button} = {buttonMode}");

                    SetLamp(button, LampMode.On);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Disconnected");
                    _connected = false;
                    Thread.Sleep(1);
                }
            }
            Connect();
        }
コード例 #6
0
 public AI_BB_WheelThrottleLock(ConfigNode node)
 {
     if (node != null)
     {
         mode = ButtonMode_methods.Parse(node.GetValue("mode"));
     }
 }
コード例 #7
0
 public AI_BB_EVAAngularBrake(ConfigNode node)
 {
     if (node != null)
     {
         mode = ButtonMode_methods.Parse(node.GetValue("mode"));
     }
 }
コード例 #8
0
 /// <summary>
 /// Creates an instance of <see cref="ButtonEx"/>
 /// </summary>
 public ButtonEx()
 {
     border     = new Pen(Color.White);
     text       = new SolidBrush(Color.White);
     ColorTheme = ButtonTheme.Black;
     mode       = ButtonMode.TwoDimensional;
 }
コード例 #9
0
 public GetButtonInfoRequest(CardGroupId cardGroup, ButtonMode buttonMode, int zoneIndex, int index)
 {
     CardGroupId = cardGroup;
     ButtonMode  = buttonMode;
     ZoneIndex   = zoneIndex;
     Index       = index;
 }
コード例 #10
0
    public bool QueryAction(string action, ButtonMode mode)
    {
        // If player isn't hooked up yet, no input.
        if (player == null)
        {
            return((mode == ButtonMode.IDLE) ? true : false);
        }

        switch (mode)
        {
        case ButtonMode.DOWN:
            return(player.GetButtonDown(action));

        case ButtonMode.HELD:
            return(player.GetButton(action));

        case ButtonMode.UP:
            return(player.GetButtonUp(action));

        case ButtonMode.IDLE:
            return(!player.GetButton(action));

        default:
            throw new System.Exception("IMPOSSIBRU!");
        }
    }
コード例 #11
0
ファイル: UI.cs プロジェクト: Slaktus/LaneDefender
    public Field(string name, string label, float width, float height, int fontSize = 35, GameObject parent = null, ContentMode contentMode = ContentMode.TextAndNumbers, ButtonMode buttonMode = ButtonMode.Left, EditMode editMode = EditMode.SingleClick, Action <Field> StartInput = null, Action <Field> EndInput = null) : base(label, width, height, parent, name, hideQuad: true, fontSize: fontSize)
    {
        this.StartInput = StartInput;
        this.EndInput   = EndInput;
        _contentMode    = contentMode;
        _buttonMode     = buttonMode;
        _editMode       = editMode;

        SetStay(( Button button ) =>
        {
            if (Input.GetMouseButtonDown((int)_buttonMode))
            {
                switch (_editMode)
                {
                case EditMode.DoubleClick:
                    if (_doubleClick)
                    {
                        _handler = Handler();
                    }
                    else
                    {
                        _doubleClick = true;
                    }
                    break;

                case EditMode.SingleClick:
                    _handler = Handler();
                    break;
                }
            }
        });
    }
コード例 #12
0
ファイル: RemoteGpio.cs プロジェクト: Ereadian/PiLib
 /// <summary>
 /// Set button mode
 /// </summary>
 /// <param name="pinNumber">Pin number.</param>
 /// <param name="mode">Button mode.</param>
 public override void SetButtonMode(int pinNumber, ButtonMode mode)
 {
     this.SendPackage(
         "Failed to send package to remote when setting button mode. Number of bytes get sent:{0}",
         (byte)Command.SetButtonMode,
         (byte)this.GetTargetPinNumber(pinNumber),
         (byte)mode);
 }
コード例 #13
0
ファイル: OrmReference.cs プロジェクト: Enzogord/QSProjects
        void OnTreeviewSelectionChanged(object sender, EventArgs e)
        {
            bool selected = ytreeviewRef.Selection.CountSelectedRows() > 0;

            buttonSelect.Sensitive = selected;
            buttonEdit.Sensitive   = ButtonMode.HasFlag(ReferenceButtonMode.CanEdit) && selected;
            buttonDelete.Sensitive = ButtonMode.HasFlag(ReferenceButtonMode.CanDelete) && selected;
        }
コード例 #14
0
 public static bool Button(ButtonMode mode, string content)
 {
     return(mode switch
     {
         ButtonMode.Label => NuklearUI.ButtonLabel(content),
         ButtonMode.Text => NuklearUI.ButtonLabel(content),
         _ => throw new NotSupportedException("Unsupported button mode.")
     });
コード例 #15
0
 public ButtonToggled(CardGroupId cardGroupId, ButtonMode buttonMode, int zoneIndex, int index, bool isToggled)
 {
     CardGroupId = cardGroupId;
     ButtonMode  = buttonMode;
     ZoneIndex   = zoneIndex;
     Index       = index;
     IsToggled   = isToggled;
 }
コード例 #16
0
    public void OnEndDrag(PointerEventData eventData)
    {
        isMoving = false;

        if (null != currentCollidedTileObj)
        {
            Space      collidedSpace     = currentCollidedTileObj.GetComponent <Space>();
            ButtonMode currentButtonMode = GameHandler.Instance.currentSelectedButton.mode;

            // if Space is EMPTY
            if (null == collidedSpace.card)
            {
                Debug.Log("Replace Empty Space");
                replaceEmptySpace(collidedSpace);

                currentCollidedTileObj = null;
                return;
            }
            else
            {
                if (ButtonMode.EATING == currentButtonMode)
                {
                    collidedSpace.card.uiTweener.AnimateReverseScaling(0.45f);
                    replaceEmptySpace(collidedSpace);
                    stacked = true;
                    GameHandler.Instance.clickedCardStatus.text = "Stacked";

                    currentCollidedTileObj = null;
                }
                else if (ButtonMode.BE_EATEN == currentButtonMode)
                {
                    Space currSpace = occupiedSpace;
                    //uiTweener.AnimateMovement(rectTransform.anchoredPosition, collidedSpace.rectTransform.anchoredPosition);
                    uiTweener.AnimateReverseScaling();
                    collidedSpace.card.changeOpacity(1.0f);
                    collidedSpace.card.stacked = true;
                    currSpace.card             = null;
                    GameHandler.Instance.ResetClickedImage();

                    return;
                }
                // ButtonMode.SWAP
                else
                {
                    Debug.Log("Swap Tile");
                    collidedSpace.card.changeOpacity(1.0f);
                    replaceWithTile(collidedSpace.card);

                    currentCollidedTileObj = null;
                    return;
                }
            }
        }

        currentCollidedTileObj = null;
        uiTweener.AnimateMovement(rectTransform.anchoredPosition, initialPosition);
    }
コード例 #17
0
        protected void onDownloadCompleted(object sender, AsyncCompletedEventArgs e)
        {
            SetMessage("Models downloaded.");
            var button = this.TopButton;

            _buttonMode      = ButtonMode.Ready;
            button.Text      = GetButtonName(_buttonMode);
            button.IsEnabled = true;
        }
コード例 #18
0
 public ButtonClickRequest(CardGroupId cardGroupId, ButtonMode buttonMode, int zoneIndex, int index, MouseButton mouseButton, ButtonOption buttonOption)
 {
     CardGroupId  = cardGroupId;
     ButtonMode   = buttonMode;
     ZoneIndex    = zoneIndex;
     Index        = index;
     MouseButton  = mouseButton;
     ButtonOption = buttonOption;
 }
コード例 #19
0
 /// <summary>
 /// Sets the mode for all buttons
 /// </summary>
 /// <param name="mode"></param>
 public void SetMode(ButtonMode mode)
 {
     Mode = mode;
     Up.SetMode(mode);
     Ok.SetMode(mode);
     Down.SetMode(mode);
     Right.SetMode(mode);
     Left.SetMode(mode);
     Back.SetMode(mode);
 }
コード例 #20
0
ファイル: InceptionPage.cs プロジェクト: htetmyatag/emgutf
        public override String GetButtonName(ButtonMode mode)
        {
            switch (mode)
            {
            case ButtonMode.WaitingModelDownload:
                return("Download Model");

            default:
                return("Recognize object");
            }
        }
コード例 #21
0
        public override String GetButtonName(ButtonMode mode)
        {
            switch (mode)
            {
            case ButtonMode.WaitingModelDownload:
                return("Download Model");

            default:
                return("Detect People");
            }
        }
コード例 #22
0
        internal Buttons()
        {
            Up    = new Button(ButtonType.Up);
            Ok    = new Button(ButtonType.Ok);
            Down  = new Button(ButtonType.Down);
            Right = new Button(ButtonType.Right);
            Left  = new Button(ButtonType.Left);
            Back  = new Button(ButtonType.Back);

            Mode = ButtonMode.Click;
        }
コード例 #23
0
ファイル: OrmReference.cs プロジェクト: kozlov-d/QSProjects
 protected void OnYtreeviewRefRowActivated(object o, RowActivatedArgs args)
 {
     if (Mode == OrmReferenceMode.Select || Mode == OrmReferenceMode.MultiSelect)
     {
         buttonSelect.Click();
     }
     else if (ButtonMode.HasFlag(ReferenceButtonMode.CanEdit))
     {
         buttonEdit.Click();
     }
 }
コード例 #24
0
 private ModSpot GetCommandedModSpot(ButtonMode mode)
 {
     if (InputManager.Instance.QueryAction(Strings.Input.Actions.FIRE_LEFT, mode))
     {
         return(ModSpot.ArmL);
     }
     if (InputManager.Instance.QueryAction(Strings.Input.Actions.FIRE_RIGHT, mode))
     {
         return(ModSpot.ArmR);
     }
     return(ModSpot.Default);
 }
コード例 #25
0
        override public void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

            XML xml = cxml.GetNode("Button");

            string str;

            str = xml.GetAttribute("mode");
            if (str != null)
            {
                _mode = FieldTypes.ParseButtonMode(str);
            }
            else
            {
                _mode = ButtonMode.Common;
            }

            str = xml.GetAttribute("sound");
            if (str != null)
            {
                sound = UIPackage.GetItemAssetByURL(str) as AudioClip;
            }

            str = xml.GetAttribute("volume");
            if (str != null)
            {
                soundVolumeScale = float.Parse(str) / 100f;
            }

            str = xml.GetAttribute("downEffect");
            if (str != null)
            {
                _downEffect      = str == "dark" ? 1 : (str == "scale" ? 2 : 0);
                _downEffectValue = xml.GetAttributeFloat("downEffectValue");
            }

            _buttonController = GetController("button");
            _titleObject      = GetChild("title");
            _iconObject       = GetChild("icon");

            if (_mode == ButtonMode.Common)
            {
                SetState(UP);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
            displayObject.onRemovedFromStage.Add(__removedFromStage);
            displayObject.onClick.Add(__click);
        }
コード例 #26
0
        /// <summary>
        /// Update all actions to make sure they show the proper information
        /// </summary>
        /// <param name="buttonMode">Refresh buttons in this card group</param>
        /// <param name="buttonMode">Refresh buttons in this mode</param>
        public void RefreshAllActions(CardGroupId cardGroupId, ButtonMode buttonMode)
        {
            IList <DynamicAction> allActions;

            lock (_dynamicActionsLock) {
                allActions = _dynamicActions.ToList();
            }

            foreach (var action in allActions.Where(x => x.CardGroupId == cardGroupId && x.ButtonMode == buttonMode))
            {
                action.UpdateButtonToNewDynamicAction();
            }
        }
コード例 #27
0
        /// <summary>
        /// Verifies if a button has been clicked, or depending on mode pressed.
        /// </summary>
        /// <param name="socket">socket for executing command to brick</param>
        /// <param name="button">type of the button</param>
        /// <param name="mode">mode of click</param>
        /// <returns><c>true</c> if clicked, otherwise <c>false</c></returns>
        public static async Task <bool> GetClick(ISocket socket, ButtonType button, ButtonMode mode = ButtonMode.Click)
        {
            Command cmd = null;

            using (CommandBuilder cb = new CommandBuilder(CommandType.DIRECT_COMMAND_REPLY, 1, 0))
            {
                BatchCommand(cb, button, mode, 0);
                cmd = cb.ToCommand();
            }
            Response response = await socket.Execute(cmd);

            return(BitConverter.ToBoolean(response.PayLoad, 0));
        }
コード例 #28
0
 public ButtonInfoChanged(CardGroupId cardGroupId, ButtonMode buttonMode, int zoneIndex, int index, string name, string code, bool isToggled, bool imageAvailable, ChangeAction action, IList <ButtonOption> buttonOptions)
 {
     CardGroupId    = cardGroupId;
     ButtonMode     = buttonMode;
     ZoneIndex      = zoneIndex;
     Index          = index;
     Name           = name;
     Code           = code;
     IsToggled      = isToggled;
     ImageAvailable = imageAvailable;
     Action         = action;
     ButtonOptions  = buttonOptions;
 }
コード例 #29
0
        public override void Awake()
        {
            base.Awake();

            addButton.onClick.AddListener(() => OnAddedHandler?.Invoke());

            removeButton.onClick.AddListener(OnRemoved);

            algorithmSelection.Algorithm.OnValueChangedHandler += (x) => replay.Algorithm = x;


            Mode = mode;
        }
コード例 #30
0
    private void CheckForModInput(Action <ModSpot> onComplete, ButtonMode mode)
    {
        List <ModSpot> chargeSpots = GetCommandedModSpots(mode);

        if (!chargeSpots.Contains(ModSpot.Default))
        {
            chargeSpots.ForEach(spot =>
            {
                if (modSocketDictionary[spot].mod != null)
                {
                    onComplete(spot);
                }
            });
        }
    }
コード例 #31
0
        internal DismissableWarningDialog(string formattedTitle, string formattedMessage, ButtonMode buttonMode)
        {
            InitializeComponent();

            // Set the default font to VS shell font.
            var vsFont = VSHelpers.GetVSFont(Services.ServiceProvider);
            if (vsFont != null)
            {
                Font = vsFont;
            }

            Text = formattedTitle;
            lblWarning.Text = formattedMessage;

            // Default button mode is OkCancel
            if (buttonMode == ButtonMode.YesNo)
            {
                okButton.Text = DialogsResource.YesButton_Text;
                cancelButton.Text = DialogsResource.NoButton_Text;
            }
        }
コード例 #32
0
ファイル: Button.cs プロジェクト: scorvi/dwarfcorp
 public Button(DwarfGUI gui, GUIComponent parent, string text, SpriteFont textFont, ButtonMode mode, ImageFrame image)
     : base(gui, parent)
 {
     DrawFrame = false;
     Text = text;
     Image = image;
     TextColor = gui.DefaultTextColor;
     HoverTextColor = Color.DarkRed;
     HoverTint = new Color(200, 200, 180);
     PressedTextColor = Color.Red;
     PressedTint = new Color(100, 100, 180);
     ToggleTint = Color.White;
     TextFont = textFont;
     CanToggle = false;
     IsToggled = false;
     OnClicked += Clicked;
     KeepAspectRatio = mode == ButtonMode.ToolButton;
     DontMakeBigger = mode == ButtonMode.ToolButton;
     Mode = mode;
     DontMakeSmaller = false;
     Transparency = 255;
 }
コード例 #33
0
        internal static bool ShowWarningDialogAndSaveDismissOption(
            string formattedTitle, string formattedMessage, string regKeyName, ButtonMode buttonMode)
        {
            var cancelled = true;

            var service = Services.ServiceProvider.GetService(typeof(IUIService)) as IUIService;
            Debug.Assert(service != null, "service should not be null");
            if (service != null)
            {
                using (var dialog = new DismissableWarningDialog(formattedTitle, formattedMessage, buttonMode))
                {
                    if (service.ShowDialog(dialog) == DialogResult.OK)
                    {
                        cancelled = false;
                        var showAgain = dialog.chkWarning.Checked == false;
                        EdmUtils.SaveUserSetting(regKeyName, showAgain.ToString());
                    }
                }
            }

            return cancelled;
        }
コード例 #34
0
 public static MvcHtmlString SPActionLink(this HtmlHelper htmlHelper, string icon, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes, ButtonMode status = ButtonMode.Default, string iconvariantclass = null)
 {
     return MvcHtmlString.Create(GenerateLinkInternal(htmlHelper.ViewContext.RequestContext, htmlHelper.RouteCollection, icon, status, linkText, null, actionName, controllerName,
         new RouteValueDictionary(routeValues), HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes), iconvariantclass, null, null));
 }
コード例 #35
0
ファイル: MapDisplay.cs プロジェクト: CPutz/MyMap
        /// <summary>
        /// Makes a click on the display.
        /// Returns true when a mapicon is placed.
        /// </summary>
        public bool OnClick(object o, MouseMapDragEventArgs mmdea)
        {
            bool placedIcon = false;

            if (ClientRectangle.Contains(mmdea.Location) && graph != null && !isCalculatingRoute)
            {
                if (mmdea.Button == MouseButtons.Left)
                {
                    Point corner = CoordToPoint(bounds.XMin, bounds.YMax);
                    Coordinate c = PointToCoord(corner.X + mmdea.X, corner.Y - mmdea.Y);

                    Node location = null;

                    switch (buttonMode)
                    {
                        case ButtonMode.From:
                            location = graph.GetNodeByPos(c.Longitude, c.Latitude, Vehicle.Foot);
                            if (location != null)
                            {
                                SetMapIcon(IconType.Start, location, mmdea.MapButton);
                                placedIcon = true;
                            }
                            break;
                        case ButtonMode.To:
                            location = graph.GetNodeByPos(c.Longitude, c.Latitude, Vehicle.Foot);
                            if (location != null && mmdea.MapButton != null)
                            {
                                SetMapIcon(IconType.End, location, mmdea.MapButton);
                                placedIcon = true;
                            }
                            break;
                        case ButtonMode.Via:
                            //location = graph.GetNodeByPos(lon, lat, Vehicle.All);
                            // Not used Vehicle.All because then are situations where you can't go to
                            // the location, and the RouteFinder doesn't support this.
                            location = graph.GetNodeByPos(c.Longitude, c.Latitude, Vehicle.Foot);
                            if (location != null && mmdea.MapButton != null)
                            {
                                SetMapIcon(IconType.Via, location, mmdea.MapButton);
                                placedIcon = true;
                            }
                            break;
                        case ButtonMode.NewBike:
                            // You can place a Bycicle at a location where you can walk.
                            location = graph.GetNodeByPos(c.Longitude, c.Latitude, new Vehicle[] { Vehicle.Bicycle, Vehicle.Foot });
                            if (location != null && mmdea.MapButton != null)
                            {
                                AddVehicle(new MyVehicle(Vehicle.Bicycle, location));
                                placedIcon = true;
                            }
                            break;
                        case ButtonMode.NewCar:
                            location = graph.GetNodeByPos(c.Longitude, c.Latitude, Vehicle.Car);
                            if (location != null && mmdea.MapButton != null)
                            {
                                AddVehicle(new MyVehicle(Vehicle.Car, location));
                                placedIcon = true;
                            }
                            break;
                    }

                    buttonMode = ButtonMode.None;
                }
                else if (mmdea.Button == MouseButtons.Right)
                {
                    foreach (MapIcon icon in icons)
                    {
                        if (icon.IntersectWith(mmdea.Location))
                        {
                            mouseDown = false;
                            lockZoom = true;

                            icons.Remove(icon);
                            myVehicles.Remove(icon.Vehicle);
                            MapIconRemoved(this, new MapDragEventArgs(icon.Button));
                            CalcRoute();
                            break;
                        }
                    }
                }

                // TODO: lelijke code
                ((MainForm)Parent).Save();

                this.Invalidate();
            }

            return placedIcon;
        }
コード例 #36
0
 public static MvcHtmlString SPActionLink(this AjaxHelper ajaxHelper, string icon, string linkText, string actionName, AjaxOptions ajaxOptions, ButtonMode status = ButtonMode.Default, string iconvariantclass = null)
 {
     return MvcHtmlString.Create(GenerateLinkInternal(ajaxHelper.ViewContext.RequestContext, ajaxHelper.RouteCollection, icon, status, linkText, null, actionName, null,
         null, null, iconvariantclass, ajaxHelper, ajaxOptions));
 }
コード例 #37
0
 public static MvcHtmlString SPActionLink(this AjaxHelper ajaxHelper, string icon, string linkText, string actionName, string controllerName, AjaxOptions ajaxOptions, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes, ButtonMode status = ButtonMode.Default, string iconvariantclass = null)
 {
     return MvcHtmlString.Create(GenerateLinkInternal(ajaxHelper.ViewContext.RequestContext, ajaxHelper.RouteCollection, icon, status, linkText, null, actionName, controllerName,
         routeValues, htmlAttributes, iconvariantclass, ajaxHelper, ajaxOptions));
 }
コード例 #38
0
        private static string GenerateLinkInternal(RequestContext requestContext,
                RouteCollection routeCollection, string icon,
                ButtonMode status, string linkText, string routeName,
                string actionName, string controllerName,
                RouteValueDictionary routeValues,
                IDictionary<string, object> htmlAttributes,
                string iconvariantclass,
                AjaxHelper ajaxHelper, AjaxOptions ajaxOptions)
        {
            //Make the link
            string targetUrl = UrlHelper.GenerateUrl(routeName, actionName,
                                controllerName, null, null, null, routeValues, routeCollection,
                                requestContext, false);

            //Tesing parameters
            if ((status & ButtonMode.IconOnly) != 0 && string.IsNullOrEmpty(icon))
                throw new Exception("Only icon button without icon, how?");

            //Prepare button caption.
            string caption = HttpUtility.HtmlEncode(linkText);
            bool disabled = (status & ButtonMode.Disabled) != 0;

            //Insert caption into a <span> with own CSS class
            TagBuilder captionTag = null;
            if ((status & ButtonMode.IconOnly) == 0)
            {
                captionTag = new TagBuilder("span") { InnerHtml = caption };
                captionTag.AddCssClass("t4button-text");
            }

            //Also insert icon into a <span>. Link this main CSS class which made by the T4 sprite-generator.
            //include unique icon name from helper method parameter
            TagBuilder iconTag = null;
            if (!string.IsNullOrEmpty(icon))
            {
                iconTag = new TagBuilder("span");
                iconTag.AddCssClass("t4icon " + IconDefaultClass + " " + icon);
                if (disabled)
                    iconTag.AddCssClass(IconDisabledClass);
                if (!string.IsNullOrEmpty(iconvariantclass))
                    iconTag.AddCssClass(iconvariantclass);
            }

            //Making a wrapper around the caption and icon
            //Disabled button wil wrap a <div>. And <a> tag for normal button status
            TagBuilder buttonTag = new TagBuilder(disabled ? "div" : "a");

            //rendering icon and caption <span> into wrapper tag
            if (iconTag == null)
                buttonTag.InnerHtml = captionTag.ToString(TagRenderMode.Normal);
            else if (captionTag == null)
                buttonTag.InnerHtml = iconTag.ToString(TagRenderMode.Normal);
            else
                buttonTag.InnerHtml = iconTag.ToString(TagRenderMode.Normal)
                                    + captionTag.ToString(TagRenderMode.Normal);

            //another attributes can arrive from helper method parameter
            buttonTag.MergeAttributes(htmlAttributes);
            buttonTag.Attributes.Add("role", "button");

            if (disabled)
            {
                buttonTag.Attributes.Add("aria-disabled", "true");
                //In 'disabled' status adding the default 'disbled' CSS class (we provided in .CssClassName= "disabled" in variant definition)
                buttonTag.AddCssClass(IconDisabledClass);
            }
            else
            {
                //URL for <a> tag
                buttonTag.MergeAttribute("href", targetUrl);
                buttonTag.Attributes.Add("aria-disabled", "false");

                //If this is a Ajax helper call, will include all unobtrusive attributes.
                //This is all differences between Html.ActionLink and Ajax.ActionLink.
                if (ajaxHelper != null && ajaxHelper.ViewContext.UnobtrusiveJavaScriptEnabled)
                    buttonTag.MergeAttributes(ajaxOptions.ToUnobtrusiveHtmlAttributes());
            }

            //Parametrizing the title attribute
            if ((status & ButtonMode.IconOnly) != 0)
            {
                buttonTag.AddCssClass("t4button-icon-only");
                buttonTag.Attributes.Add("title", caption);
            }
            else
            {
                buttonTag.AddCssClass(iconTag == null ? "t4button-text-only" : "t4button-text-icon");
                if ((status & ButtonMode.ShowTitle) != 0)
                    buttonTag.Attributes.Add("title", caption);
            }

            buttonTag.AddCssClass("t4button");

            //Rendering all
            return buttonTag.ToString(TagRenderMode.Normal);
        }
コード例 #39
0
ファイル: UIElements.cs プロジェクト: CPutz/MyMap
        public MapDragButton(MapDisplay map, Bitmap icon, ButtonMode mode, MainForm parent, bool removeIcon)
        {
            this.MouseDown += (object o, MouseEventArgs mea) => {
                if (!iconPlaced || !removeIcon)
                {
                    mousePos = mea.Location;
                    map.BMode = mode;
                    this.PerformClick();
                    if (removeIcon)
                        this.BackgroundImage = null;
                    parent.ChangeCursor(icon);
                }
            };

            this.MouseUp += (object o, MouseEventArgs mea) => {
                if (!iconPlaced || !removeIcon)
                {
                    parent.ChangeCursorBack();
                    this.Invalidate();
                    if (!map.OnClick(o, new MouseMapDragEventArgs(this,
                                                                     mea.Button,
                                                                     mea.Clicks,
                                                                     mea.X + this.Location.X - map.Location.X,
                                                                     mea.Y + this.Location.Y - map.Location.Y,
                                                                     mea.Delta)))
                    {
                        // If map.OnClick returns false it means that the icon isn't placed
                        // so if the backgroundimage is removed, it should be placed back.
                        if (removeIcon)
                        {
                            this.BackgroundImage = icon;
                        }
                    }
                    else
                    {
                        iconPlaced = true;
                    }

                    map.BMode = ButtonMode.None;
                }
            };

            map.MapIconPlaced += (object o, MapDragEventArgs mdea) => {
                // If the MapIcon that links to this button is placed, the icon
                // on this button should be removed.
                if (mdea.Button == this)
                {
                    if (removeIcon)
                        this.BackgroundImage = null;
                    iconPlaced = true;
                }
            };

            map.MapIconRemoved += (object o, MapDragEventArgs mdea) => {
                // If the MapIcon that links to this button is removed, the icon
                // on this button should be visible.
                if (mdea.Button == this)
                {
                    if (removeIcon)
                        this.BackgroundImage = icon;
                    iconPlaced = false;
                }
            };

            this.icon = icon;
        }
コード例 #40
0
 public static MvcHtmlString SPActionLink(this HtmlHelper htmlHelper, string icon, string linkText, string actionName, string controllerName, ButtonMode status = ButtonMode.Default, string iconvariantclass = null)
 {
     return MvcHtmlString.Create(GenerateLinkInternal(htmlHelper.ViewContext.RequestContext, htmlHelper.RouteCollection, icon, status, linkText, null, actionName, controllerName,
         null, null, iconvariantclass, null, null));
 }
コード例 #41
0
        public override void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

            XML xml = cxml.GetNode("Button");

            string str;
            str = xml.GetAttribute("mode");
            if (str != null)
                _mode = FieldTypes.ParseButtonMode(str);
            else
                _mode = ButtonMode.Common;

            str = xml.GetAttribute("sound");
            if (str != null)
                sound = UIPackage.GetItemAssetByURL(str) as AudioClip;

            str = xml.GetAttribute("volume");
            if (str != null)
                soundVolumeScale = float.Parse(str) / 100f;

            str = xml.GetAttribute("downEffect");
            if (str != null)
            {
                _downEffect = str == "dark" ? 1 : (str == "scale" ? 2 : 0);
                _downEffectValue = xml.GetAttributeFloat("downEffectValue");
            }

            _buttonController = GetController("button");
            _titleObject = GetChild("title");
            _iconObject = GetChild("icon");

            if (_mode == ButtonMode.Common)
                SetState(UP);

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
            displayObject.onRemovedFromStage.Add(__removedFromStage);
            displayObject.onClick.Add(__click);
        }
コード例 #42
0
 /// <summary>
 /// The constructor of the GUIMenuButton class as a dialog list.
 /// </summary>
 /// <param name="dwParentID">The parent of this control.</param>
 /// <param name="dwControlId">The ID of this control.</param>
 /// <param name="dwPosX">The X position of this control.</param>
 /// <param name="dwPosY">The Y position of this control.</param>
 /// <param name="dwWidth">The width of this control.</param>
 /// <param name="dwHeight">The height of this control.</param>
 /// <param name="dwShadowAngle">The angle of the shadow; zero degrees along x-axis.</param>
 /// <param name="dwShadowDistance">The height of the shadow.</param>
 /// <param name="dwShadowColor">The color of the shadow.</param>
 public GUIMenuButton(int dwParentID, int dwControlId, int dwPosX,
                      int dwPosY, int dwWidth, int dwHeight,
                      int dwShadowAngle, int dwShadowDistance, long dwShadowColor)
   : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
 {
   _buttonMode = ButtonMode.BUTTON_MODE_DIALOG_LIST;
   _shadowAngle = dwShadowAngle;
   _shadowDistance = dwShadowDistance;
   _shadowColor = dwShadowColor;
   FinalizeConstruction();
 }
コード例 #43
0
 /// <summary>
 /// The constructor of the GUIMenuButton class as a spin list.
 /// </summary>
 /// <param name="dwParentID">The parent of this control.</param>
 /// <param name="dwControlId">The ID of this control.</param>
 /// <param name="dwPosX">The X position of this control.</param>
 /// <param name="dwPosY">The Y position of this control.</param>
 /// <param name="dwWidth">The width of this control.</param>
 /// <param name="dwHeight">The height of this control.</param>
 /// <param name="strTextureFocus">The filename containing the texture of the button, when the button has the focus.</param>
 /// <param name="strTextureNoFocus">The filename containing the texture of the button, when the button does not have the focus.</param>
 /// <param name="strUpFocus">The filename containing the texture of the spin up button, when the button has the focus.</param>
 /// <param name="strUpNoFocus">The filename containing the texture of the spin up button, when the button does not have the focus.</param>
 /// <param name="strDownFocus">The filename containing the texture of the spin down button, when the button has the focus.</param>
 /// <param name="strDownNoFocus">The filename containing the texture of the spin down button, when the button does not have the focus.</param>
 /// <param name="dwSpinWidth">The width of the spin control.</param>
 /// <param name="dwSpinHeight">The height of the spin control.</param>
 /// <param name="dwShadowAngle">The angle of the shadow; zero degrees along x-axis.</param>
 /// <param name="dwShadowDistance">The height of the shadow.</param>
 /// <param name="dwShadowColor">The color of the shadow.</param>
 public GUIMenuButton(int dwParentID, int dwControlId, int dwPosX,
                      int dwPosY, int dwWidth, int dwHeight,
                      string strTextureFocus, string strTextureNoFocus,
                      string strUpFocus, string strUpNoFocus, string strDownFocus, string strDownNoFocus,
                      int dwSpinWidth, int dwSpinHeight,
                      int dwShadowAngle, int dwShadowDistance, long dwShadowColor)
   : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
 {
   _buttonMode = ButtonMode.BUTTON_MODE_SPIN_LIST;
   _focusedTextureName = strTextureFocus;
   _nonFocusedTextureName = strTextureNoFocus;
   _upTextureName = strUpNoFocus;
   _upTextureNameFocus = strUpFocus;
   _downTextureName = strDownNoFocus;
   _downTextureNameFocus = strDownFocus;
   _spinWidth = dwSpinWidth;
   _spinHeight = dwSpinHeight;
   _shadowAngle = dwShadowAngle;
   _shadowDistance = dwShadowDistance;
   _shadowColor = dwShadowColor;
   FinalizeConstruction();
 }