Ejemplo n.º 1
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            string value = null,
            ButtonType? type = null,
            Disabled? disabled = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Name = name;
            Value = value;
            Type = type;
            Disabled = disabled;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
Ejemplo n.º 2
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            int? size = null,
            Multiple? multiple = null,
            Disabled? disabled = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null,
            string onchange = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Name = name;
            Size = size;
            Multiple = multiple;
            Disabled = disabled;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;
            OnChange = onchange;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Ejemplo n.º 3
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Selected? selected = null,
            Disabled? disabled = null,
            string label = null,
            string value = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Selected = selected;
            Disabled = disabled;
            Label = label;
            Value = value;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
Ejemplo n.º 4
0
 /// <inheritdoc />
 public override ThemeBase Clone()
 {
     return(new RadioButtonTheme()
     {
         Normal = Normal.Clone(),
         Disabled = Disabled.Clone(),
         MouseOver = MouseOver.Clone(),
         MouseDown = MouseDown.Clone(),
         Selected = Selected.Clone(),
         Focused = Focused.Clone(),
         CheckedIcon = CheckedIcon.Clone(),
         UncheckedIcon = UncheckedIcon.Clone(),
         LeftBracket = LeftBracket.Clone(),
         RightBracket = RightBracket.Clone(),
     });
 }
Ejemplo n.º 5
0
 /// <inheritdoc />
 public override ThemeBase Clone() => new ScrollBarTheme()
 {
     Colors    = Colors?.Clone(),
     Normal    = Normal.Clone(),
     Disabled  = Disabled.Clone(),
     MouseOver = MouseOver.Clone(),
     MouseDown = MouseDown.Clone(),
     Selected  = Selected.Clone(),
     Focused   = Focused.Clone(),
     StartButtonVerticalGlyph   = StartButtonVerticalGlyph,
     EndButtonVerticalGlyph     = EndButtonVerticalGlyph,
     StartButtonHorizontalGlyph = StartButtonHorizontalGlyph,
     EndButtonHorizontalGlyph   = EndButtonHorizontalGlyph,
     BarGlyph    = BarGlyph,
     SliderGlyph = SliderGlyph
 };
Ejemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Username != null ? Username.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Domain != null ? Domain.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ApiKey != null ? ApiKey.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Database != null ? Database.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)TransitiveReplicationBehavior;
         hashCode = (hashCode * 397) ^ IgnoredClient.GetHashCode();
         hashCode = (hashCode * 397) ^ Disabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (ClientVisibleUrl != null ? ClientVisibleUrl.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            dc.State.RemoveValue(Property.GetValue(dc.State));

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 8
0
 public static void SaveConfig()
 {
     SaveEntry("reset_delay", m_delay.ToString());
     Language.Save();
     ComposeKey.Save();
     Disabled.Save();
     UnicodeInput.Save();
     CaseInsensitive.Save();
     DiscardOnInvalid.Save();
     BeepOnInvalid.Save();
     KeepOriginalKey.Save();
     InsertZwsp.Save();
     EmulateCapsLock.Save();
     ShiftDisablesCapsLock.Save();
     CapsLockCapitalizes.Save();
 }
Ejemplo n.º 9
0
 /// <inheritdoc />
 public override ThemeBase Clone()
 {
     return(new ListBoxTheme((ScrollBarTheme)ScrollBarTheme.Clone())
     {
         Colors = Colors?.Clone(),
         Normal = Normal.Clone(),
         Disabled = Disabled.Clone(),
         MouseOver = MouseOver.Clone(),
         MouseDown = MouseDown.Clone(),
         Selected = Selected.Clone(),
         Focused = Focused.Clone(),
         BorderTheme = BorderTheme.Clone(),
         BorderLineStyle = (int[])BorderLineStyle.Clone(),
         DrawBorder = DrawBorder,
     });
 }
Ejemplo n.º 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Uid.Length != 0)
            {
                hash ^= Uid.GetHashCode();
            }
            if (Email.Length != 0)
            {
                hash ^= Email.GetHashCode();
            }
            if (EmailVerified != false)
            {
                hash ^= EmailVerified.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            if (PhotoURL.Length != 0)
            {
                hash ^= PhotoURL.GetHashCode();
            }
            if (Disabled != false)
            {
                hash ^= Disabled.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            hash ^= providerData_.GetHashCode();
            if (PhoneNumber.Length != 0)
            {
                hash ^= PhoneNumber.GetHashCode();
            }
            if (customClaims_ != null)
            {
                hash ^= CustomClaims.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Returns a clone of this object.
 /// </summary>
 /// <returns>The cloned object.</returns>
 public override object Clone()
 {
     return(new ListBoxTheme()
     {
         Normal = Normal.Clone(),
         Disabled = Disabled.Clone(),
         MouseOver = MouseOver.Clone(),
         MouseDown = MouseDown.Clone(),
         Selected = Selected.Clone(),
         Focused = Focused.Clone(),
         BorderTheme = BorderTheme.Clone(),
         BorderLineStyle = (int[])BorderLineStyle.Clone(),
         DrawBorder = DrawBorder,
         ItemTheme = (ListBoxItemTheme)ItemTheme.Clone(),
         ScrollBarTheme = (ScrollBarTheme)ScrollBarTheme.Clone()
     });
 }
Ejemplo n.º 12
0
 protected void OnStateChanged(Boolean state)
 {
     if (state)
     {
         if (Enabled != null)
         {
             Enabled.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (Disabled != null)
         {
             Disabled.Invoke(this, EventArgs.Empty);
         }
     }
 }
Ejemplo n.º 13
0
        public async Task <IHttpActionResult> SaveUserInfo(int id, Disabled Disabled)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != Disabled.ID)
            {
                return(BadRequest());
            }

            db.Entry(Disabled).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 14
0
        /// <inheritdoc/>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            if (Card == null)
            {
                throw new ArgumentException($"A valid card is required for {Kind}.");
            }

            var activity = await Card.BindAsync(dc, dc.State).ConfigureAwait(false);

            if (activity?.Attachments?.Any() != true)
            {
                throw new InvalidOperationException($"Invalid activity. An attachment is required for {Kind}.");
            }

            var attachment          = activity.Attachments[0];
            var extensionAttachment = new MessagingExtensionAttachment(attachment.ContentType, null, attachment.Content);

            var response = new MessagingExtensionResponse
            {
                ComposeExtension = new MessagingExtensionResult
                {
                    Type             = MEResultResponseType.result.ToString(),
                    AttachmentLayout = MEAttachmentLayoutResponseType.list.ToString(), // TODO: enum this
                    Attachments      = new List <MessagingExtensionAttachment> {
                        extensionAttachment
                    }
                },
                CacheInfo = GetCacheInfo(dc),
            };

            var invokeResponse            = CreateInvokeResponseActivity(response);
            ResourceResponse sendResponse = await dc.Context.SendActivityAsync(invokeResponse, cancellationToken : cancellationToken).ConfigureAwait(false);

            return(await dc.EndDialogAsync(sendResponse, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// This method is overridden to deal with an issue where if 2 skills are called back to back then the
        /// "EndOfConversation" activity which gets returned from the 1st skill is passed to the 2nd skill.
        /// This prevents the 2nd skill from running successfully because there is logic on the skill side which will
        /// CancelAllDialogs when an EndOfConversation activitiy is passed
        ///
        /// In this overridden version we will detect if an "EndOfConversation" is passed in & then pass in a blank activity.
        /// I'm not sure if this will cause any other issues. I will need to watch out for this as we continue to build more complex dialogs.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default)
        {
            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            // Update the dialog options with the runtime settings.
            DialogOptions.BotId                 = BotId.GetValue(dc.State);
            DialogOptions.SkillHostEndpoint     = new Uri(SkillHostEndpoint.GetValue(dc.State));
            DialogOptions.ConversationIdFactory = dc.Context.TurnState.Get <SkillConversationIdFactoryBase>() ?? throw new NullReferenceException("Unable to locate SkillConversationIdFactoryBase in HostContext");
            DialogOptions.SkillClient           = dc.Context.TurnState.Get <BotFrameworkClient>() ?? throw new NullReferenceException("Unable to locate BotFrameworkClient in HostContext");
            DialogOptions.ConversationState     = dc.Context.TurnState.Get <ConversationState>() ?? throw new NullReferenceException($"Unable to get an instance of {nameof(ConversationState)} from TurnState.");
            DialogOptions.ConnectionName        = ConnectionName.GetValue(dc.State);

            // Set the skill to call
            DialogOptions.Skill.Id            = DialogOptions.Skill.AppId = SkillAppId.GetValue(dc.State);
            DialogOptions.Skill.SkillEndpoint = new Uri(SkillEndpoint.GetValue(dc.State));

            // Store the initialized DialogOptions in state so we can restore these values when the dialog is resumed.
            dc.ActiveDialog.State[_dialogOptionsStateKey] = DialogOptions;

            // Get the activity to send to the skill.
            Activity activity = null;

            if (Activity != null && ActivityProcessed.GetValue(dc.State))
            {
                // The parent consumed the activity in context, use the Activity property to start the skill.
                activity = await Activity.BindAsync(dc, cancellationToken : cancellationToken).ConfigureAwait(false);
            }
            else if (dc.Context.Activity.Type.Equals(ActivityTypes.EndOfConversation))
            {
                //if an EndOfConversation activity is passed then we are assuming that this was becasue another skill
                //was called immediately before this one & the EndOfConversation from that has been passed to this skill
                //we need to prevent this issue otherwise this skill will not be called
                activity = new Activity()
                {
                    Type = ActivityTypes.Event
                };
            }

            // Call the base to invoke the skill
            // (If the activity has not been processed, send the turn context activity to the skill (pass through)).
            return(await base.BeginDialogAsync(dc, new BeginSkillDialogOptions { Activity = activity ?? dc.Context.Activity }, cancellationToken).ConfigureAwait(false));
        }
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State) == true)
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            if (Card == null)
            {
                throw new ArgumentException($"A valid {nameof(Card)} is required for {Kind}.");
            }

            var activity = await Card.BindAsync(dc, dc.State).ConfigureAwait(false);

            if (activity?.Attachments?.Any() != true)
            {
                throw new InvalidOperationException($"Invalid activity. An attachment is required for {Kind}.");
            }

            Attachment attachment = activity.Attachments[0];

            var response = new MessagingExtensionActionResponse
            {
                ComposeExtension = new MessagingExtensionResult
                {
                    Type            = MessagingExtensionResultResponseType.botMessagePreview.ToString(),
                    ActivityPreview = MessageFactory.Attachment(new Attachment
                    {
                        Content     = attachment.Content,
                        ContentType = attachment.ContentType,
                    }) as Activity,
                },
                CacheInfo = GetCacheInfo(dc),
            };

            var invokeResponse            = CreateInvokeResponseActivity(response);
            ResourceResponse sendResponse = await dc.Context.SendActivityAsync(invokeResponse, cancellationToken : cancellationToken).ConfigureAwait(false);

            return(await dc.EndDialogAsync(sendResponse, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Disabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (UserName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Password?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Priority;
         hashCode = (hashCode * 397) ^ (Certificate?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (CertificatePassword?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ BypassProxy.GetHashCode();
         hashCode = (hashCode * 397) ^ AllowSelfService.GetHashCode();
         hashCode = (hashCode * 397) ^ VisibleToAdminsOnly.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Returns a clone of this object.
 /// </summary>
 /// <returns>The cloned object.</returns>
 public override object Clone()
 {
     return(new ScrollBarTheme()
     {
         Normal = Normal.Clone(),
         Disabled = Disabled.Clone(),
         MouseOver = MouseOver.Clone(),
         MouseDown = MouseDown.Clone(),
         Selected = Selected.Clone(),
         Focused = Focused.Clone(),
         StartButtonVerticalGlyph = StartButtonVerticalGlyph,
         EndButtonVerticalGlyph = EndButtonVerticalGlyph,
         StartButtonHorizontalGlyph = StartButtonHorizontalGlyph,
         EndButtonHorizontalGlyph = EndButtonHorizontalGlyph,
         BarGlyph = BarGlyph,
         SliderGlyph = SliderGlyph
     });
 }
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default)
        {
            var dialogArgs = ValidateBeginDialogArgs(options);

            // Create deep clone of the original activity to avoid altering it before forwarding it.
            var skillActivity = ObjectPath.Clone(dialogArgs.Activity);

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            // Update the dialog options with the runtime settings.
            DialogOptions.BotId                 = BotId.GetValue(dc.State);
            DialogOptions.SkillHostEndpoint     = new Uri(SkillHostEndpoint.GetValue(dc.State));
            DialogOptions.ConversationIdFactory = dc.Context.TurnState.Get <SkillConversationIdFactoryBase>() ?? throw new NullReferenceException("Unable to locate SkillConversationIdFactoryBase in HostContext");
            DialogOptions.SkillClient           = dc.Context.TurnState.Get <BotFrameworkClient>() ?? throw new NullReferenceException("Unable to locate BotFrameworkClient in HostContext");
            DialogOptions.ConversationState     = dc.Context.TurnState.Get <ConversationState>() ?? throw new NullReferenceException($"Unable to get an instance of {nameof(ConversationState)} from TurnState.");
            DialogOptions.ConnectionName        = ConnectionName.GetValue(dc.State);

            // Set the skill to call
            DialogOptions.Skill.Id            = DialogOptions.Skill.AppId = SkillAppId.GetValue(dc.State);
            DialogOptions.Skill.SkillEndpoint = new Uri(SkillEndpoint.GetValue(dc.State));

            // Store the initialized DialogOptions in state so we can restore these values when the dialog is resumed.
            dc.ActiveDialog.State[_dialogOptionsStateKey] = DialogOptions;

            // Get the activity to send to the skill.
            Activity activity = null;

            if (Activity != null && ActivityProcessed.GetValue(dc.State))
            {
                // The parent consumed the activity in context, use the Activity property to start the skill.
                activity = await Activity.BindAsync(dc, cancellationToken : cancellationToken).ConfigureAwait(false);
            }
            else if (skillActivity != null)
            {
                activity = skillActivity;
            }

            // Call the base to invoke the skill
            // (If the activity has not been processed, send the turn context activity to the skill (pass through)).
            return(await base.BeginDialogAsync(dc, new BeginSkillDialogOptions { Activity = activity ?? dc.Context.Activity }, cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 20
0
        /// <inheritdoc/>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            string configUrl = ConfigUrl.GetValueOrNull(dc.State);

            if (string.IsNullOrEmpty(configUrl))
            {
                throw new InvalidOperationException($"{nameof(ConfigUrl)} is required for {Kind}.");
            }

            var response = new MessagingExtensionResponse
            {
                ComposeExtension = new MessagingExtensionResult
                {
                    Type             = MEResultResponseType.config.ToString(),
                    SuggestedActions = new MessagingExtensionSuggestedAction
                    {
                        Actions = new List <CardAction>
                        {
                            new CardAction
                            {
                                Type  = ActionTypes.OpenUrl,
                                Value = configUrl,
                            },
                        },
                    },
                },
                CacheInfo = GetCacheInfo(dc)
            };

            var invokeResponse            = CreateInvokeResponseActivity(response);
            ResourceResponse sendResponse = await dc.Context.SendActivityAsync(invokeResponse, cancellationToken : cancellationToken).ConfigureAwait(false);

            return(await dc.EndDialogAsync(sendResponse, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 21
0
        public async Task <IHttpActionResult> SaveUserSignUrl(int disabledID, string userSignUrl)
        {
            Disabled Disabled = await db.Disableds.FindAsync(disabledID);

            if (Disabled == null)
            {
                return(NotFound());
            }
            try
            {
                Disabled.UserSignUrl = userSignUrl;
                db.SaveChanges();
                return(Ok(disabledID));
            }
            catch (Exception e)
            {
                return(Ok(e));
            }
        }
Ejemplo n.º 22
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (overrideCase_ == OverrideOneofCase.Disabled)
            {
                hash ^= Disabled.GetHashCode();
            }
            if (overrideCase_ == OverrideOneofCase.Buffer)
            {
                hash ^= Buffer.GetHashCode();
            }
            hash ^= (int)overrideCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 23
0
        public override string ToString()
        {
            var sText = new StringBuilder();

            sText.Append("[");
            sText.Append("LastName=" + LastName + ";");
            sText.Append("FirstName=" + FirstName + ";");
            sText.Append("Patronymic=" + Patronymic + ";");
            sText.Append("Registered=" + Registered.ToString() + ";");
            sText.Append("Disabled=" + Disabled.ToString() + ";");
            sText.Append("DisabledLocally=" + DisabledLocally.ToString() + ";");
            sText.Append("Num=" + Number.ToString() + ";");
            sText.Append("Biography=" + Biography + ";");
            sText.Append("SelfRegistered=" + SelfRegistered.ToString() + ";");
            sText.Append("Party=" + Party + ";");
            sText.Append("ID=" + Id + ";");
            sText.Append("NoneAbove=" + NoneAbove.ToString());
            sText.Append("]");
            return(sText.ToString());
        }
Ejemplo n.º 24
0
#pragma warning restore CA2227 // Collection properties should be read only

        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            foreach (var propValue in this.Assignments)
            {
                var value = propValue.Value?.EvaluateExpression(dc.State);
                dc.State.SetValue(propValue.Property.GetValue(dc.State), value);
            }

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            if (this.Value != null)
            {
                var value = Value?.EvaluateExpression(dc.State);
                return(await EndParentDialogAsync(dc, value, cancellationToken).ConfigureAwait(false));
            }

            return(await EndParentDialogAsync(dc, result : null, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 26
0
        public async override Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, Object options = null, CancellationToken cancellationToken = default)
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            if (this.Dialog == null)
            {
                throw new InvalidOperationException($"AddDialogCall: operation couldn't be performed because the {nameof(Dialog)} wasn't specified.");
            }

            // Resolve dialog that was configured
            var dialog = this.ResolveDialog(dc);

            // use bindingOptions to bind to the bound options
            var boundOptions = BindOptions(dc, options);

            if (this.DialogsProperty == null)
            {
                throw new InvalidOperationException($"AddDialogCall: \"{dialog.Id}\" operation couldn't be performed because the {nameof(DialogsProperty)} wasn't specified.");
            }

            // Append dialog and options to array
            var property = this.DialogsProperty.GetValue(dc.State);
            var array    = dc.State.GetValue <JArray>(property, () => new JArray());

            array.Add(new JObject()
            {
                { "id", dialog.Id },
                { "options", boundOptions }
            });
            dc.State.SetValue(property, array);

            return(await dc.EndDialogAsync(null, cancellationToken));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            bool   handled;
            var    eventName   = EventName?.GetValue(dc.State);
            var    bubbleEvent = BubbleEvent.GetValue(dc.State);
            object value       = null;

            if (EventValue != null)
            {
                value = this.EventValue.GetValue(dc.State);
            }

            if (dc.Parent != null)
            {
                handled = await dc.Parent.EmitEventAsync(eventName, value, bubbleEvent, false, cancellationToken).ConfigureAwait(false);
            }
            else
            {
                handled = await dc.EmitEventAsync(eventName, value, bubbleEvent, false, cancellationToken).ConfigureAwait(false);
            }

            // Save results of operation
            var handledProperty = HandledProperty?.GetValue(dc.State) ?? null;

            if (!string.IsNullOrEmpty(handledProperty))
            {
                dc.State.SetValue(handledProperty, handled);
            }

            return(await dc.EndDialogAsync(handled, cancellationToken).ConfigureAwait(false));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ServletPath != null)
         {
             hashCode = hashCode * 59 + ServletPath.GetHashCode();
         }
         if (Disabled != null)
         {
             hashCode = hashCode * 59 + Disabled.GetHashCode();
         }
         if (CorsAccessControlAllowOrigin != null)
         {
             hashCode = hashCode * 59 + CorsAccessControlAllowOrigin.GetHashCode();
         }
         return(hashCode);
     }
 }
#pragma warning restore CA2227 // Collection properties should be read only

        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            if (this.EventName != null)
            {
                TelemetryClient.TrackEvent(
                    this.EventName.GetValue(dc.State),
                    this.Properties?.ToDictionary(kv => kv.Key, kv => kv.Value.GetValue(dc.State)));
            }

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
        }
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            var result = await GetMembersAsync(dc.Context, cancellationToken).ConfigureAwait(false);

            if (this.Property != null)
            {
                dc.State.SetValue(this.Property.GetValue(dc.State), result);
            }

            return(await dc.EndDialogAsync(result, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 31
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Name != null?Name.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (int)Type;
                hashCode = (hashCode * 397) ^ (From != null ? From.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (int)Rel;
                hashCode = (hashCode * 397) ^ (int)Scope;
                hashCode = (hashCode * 397) ^ (Default != null ? Default.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Nullable.GetHashCode();
                hashCode = (hashCode * 397) ^ Required.GetHashCode();
                hashCode = (hashCode * 397) ^ Disabled.GetHashCode();
                hashCode = (hashCode * 397) ^ Protected.GetHashCode();
                hashCode = (hashCode * 397) ^ Personal.GetHashCode();
                hashCode = (hashCode * 397) ^ (Annotations != null ? Annotations.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
                return(hashCode);
            }
        }
Ejemplo n.º 32
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Disabled.GetHashCode();
                if (RawPolicy != null)
                {
                    hashCode = (hashCode * 397) ^ RawPolicy.GetHashCode();
                }

                if (Policies != null)
                {
                    foreach (var policy in Policies)
                    {
                        hashCode = (hashCode * 397) ^ policy.GetHashCode();
                    }
                }

                return(hashCode);
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            object value = null;

            if (ErrorValue != null)
            {
                value = this.ErrorValue.GetValue(dc.State);
            }

            throw new InvalidOperationException(value?.ToString());
        }
Ejemplo n.º 34
0
 public static TagInput disabled(this TagInput tag, Disabled value) { tag.Disabled = value; return tag; }
Ejemplo n.º 35
0
 public static TagOptGroup disabled(this TagOptGroup tag, Disabled value) { tag.Disabled = value; return tag; }
Ejemplo n.º 36
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            int? rows = null,
            int? cols = null,
            Disabled? disabled = null,
            ReadOnly? @readonly = null,
            string onselect = null,
            string onchange = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Name = name;
            Rows = rows;
            Cols = cols;
            Disabled = disabled;
            ReadOnly = @readonly;
            OnSelect = onselect;
            OnChange = onchange;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
Ejemplo n.º 37
0
 public static TagSelect disabled(this TagSelect tag, Disabled value) { tag.Disabled = value; return tag; }
Ejemplo n.º 38
0
 public static TagTextArea disabled(this TagTextArea tag, Disabled value) { tag.Disabled = value; return tag; }
Ejemplo n.º 39
0
 public static TagButton disabled(this TagButton tag, Disabled value) { tag.Disabled = value; return tag; }
Ejemplo n.º 40
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            InputType? type = null,
            string name = null,
            string value = null,
            Checked? @checked = null,
            Disabled? disabled = null,
            ReadOnly? @readonly = null,
            int? size = null,
            int? maxlength = null,
            string src = null,
            string alt = null,
            string usemap = null,
            IsMap? ismap = null,
            string onselect = null,
            string onchange = null,
            MimeType[] accept = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Type = type;
            Name = name;
            Value = value;
            Checked = @checked;
            Disabled = disabled;
            ReadOnly = @readonly;
            Size = size;
            MaxLength = maxlength;
            Src = src;
            Alt = alt;
            UseMap = usemap;
            IsMap = ismap;
            OnSelect = onselect;
            OnChange = onchange;
            Accept = accept;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }