/// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
         ThisAction.Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 2
0
        private EventHandler GetLeaveHandler(FieldAndPropertyWrapper arg)
        {
            ActionArgumentAttribute argAttr = arg.GetArgumentAttribute();

            if (argAttr.OnLeaveHandlerName == null)
            {
                return(null);
            }
            Type       actionType = ThisAction.GetType();
            MethodInfo method     = actionType.GetMethod(argAttr.OnLeaveHandlerName);

            return((sender, e) => method.Invoke(ThisAction, new[] { sender, e }));
        }
Ejemplo n.º 3
0
        private void NonLiteralOnTextChanged(object sender, EventArgs eventArgs)
        {
            RichTextBox rtb         = (RichTextBox)sender;
            string      text        = rtb.Text;
            int         oldPos      = rtb.SelectionStart;
            var         expressions = ThisAction.FindPythonExpressions(text);

            foreach (Expression expression in expressions)
            {
                int find = rtb.Find(expression.Template);
                rtb.Select(find, expression.Template.Length);
                rtb.SelectionColor = Color.Blue;
            }
            rtb.Select(oldPos, 0);
            rtb.SelectionColor = Color.Black;
        }
Ejemplo n.º 4
0
        public IActionResult Leave(int activityId)
        {
            if (HttpContext.Session.GetString("id") == null)
            {
                return(RedirectToAction("Index"));
            }
            User         currentUser     = dbContext.Users.SingleOrDefault(user => user.UserId == HttpContext.Session.GetInt32("id"));
            ThisActivity currentActivity = dbContext.Activities.
                                           Include(a => a.Participants)
                                           .ThenInclude(p => p.User)
                                           .SingleOrDefault(a => a.ThisActivityId == activityId);
            ThisAction currentAction = dbContext.Actions.FirstOrDefault(a => a.UserId == HttpContext.Session.GetInt32("id") && a.ThisActivityId == activityId);

            currentActivity.Participants.Remove(currentAction);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Ejemplo n.º 5
0
        private void PopulateComboBox()
        {
            ICentipedeCore core = ThisAction.GetCurrentCore();

            lock (core.Job)
            {
                var actionIter = from Action a in core.Job.Actions
                                 where a != ThisAction
                                 select new
                {
                    Text = String.Format("{0}: {1}",
                                         a.Name, a.Comment),
                    Action = a
                };
                _actionCombo.DataSource = actionIter.ToList();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Populate Attribute table with controls for <see cref="ThisAction"/>'s arguments
        /// </summary>
        protected void GenerateArguments()
        {
            Type actionType = ThisAction.GetType();

            var fieldArguments = from fi in actionType.GetMembers()
                                 where fi is FieldInfo || fi is PropertyInfo
                                 select(FieldAndPropertyWrapper) fi
                                 into wrapped
                                 let argattr = wrapped.GetArgumentAttribute()
                                                   where argattr != null
                                               orderby argattr.DisplayOrder
                                               select wrapped;

            foreach (FieldAndPropertyWrapper arg in fieldArguments)
            {
                AttributeTable.Controls.AddRange(GenerateFieldControls(arg));
            }
        }
Ejemplo n.º 7
0
        public IActionResult Join(int activityId)
        {
            if (HttpContext.Session.GetString("id") == null)
            {
                return(RedirectToAction("Index"));
            }
            User         currentUser     = dbContext.Users.SingleOrDefault(user => user.UserId == HttpContext.Session.GetInt32("id"));
            ThisActivity currentActivity = dbContext.Activities.
                                           Include(a => a.Participants)
                                           .ThenInclude(p => p.User)
                                           .SingleOrDefault(a => a.ThisActivityId == activityId);
            ThisAction newAction = new ThisAction {
                UserId         = currentUser.UserId,
                User           = currentUser,
                ThisActivityId = currentActivity.ThisActivityId,
                ThisActivity   = currentActivity
            };

            currentActivity.Participants.Add(newAction);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Ejemplo n.º 8
0
 public static ThisAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> ThisAndArguments
 <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
     ThisAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> del)
 {
     return(del);
 }
Ejemplo n.º 9
0
 public static ThisAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ThisAndArguments
 <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(ThisAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> del)
 {
     return(del);
 }
Ejemplo n.º 10
0
 public static ThisAction <T1, T2, T3, T4, T5, T6> ThisAndArguments <T1, T2, T3, T4, T5, T6>(
     ThisAction <T1, T2, T3, T4, T5, T6> del)
 {
     return(del);
 }
Ejemplo n.º 11
0
 public static ThisAction <T1, T2, T3> ThisAndArguments <T1, T2, T3>(ThisAction <T1, T2, T3> del)
 {
     return(del);
 }
Ejemplo n.º 12
0
 public static ThisAction <T1> ThisAndArguments <T1>(ThisAction <T1> del)
 {
     return(del);
 }
Ejemplo n.º 13
0
 public static ThisAction ThisAndArguments(ThisAction del)
 {
     return(del);
 }
Ejemplo n.º 14
0
 public TypeProjector Initializer(ThisAction initializer)
 {
     _prototype.Initializer = initializer;
     return(this);
 }