//TODO: Create  and Check the Column exists to store the transition key from adbe
        public override CompositeActivity AddActivityToWorkflow(PublishContext context)
        {
            // Prepare a keyed collection of ActivityParameterHelper objects.
            Dictionary <string, ActivityParameterHelper> parameters =
                context.Config.GetParameterHelpers();

            // TODO: Instantiate the workflow activity.
            UploadItemToSignActivity activity = new UploadItemToSignActivity();

            parameters[UploadItemToSignActivity.KeyApproversPropertyName].AssignTo(activity, UploadItemToSignActivity.ApproversProperty, context);
            parameters[UploadItemToSignActivity.KeyUrlMiscInfoPropertyName].AssignTo(activity, UploadItemToSignActivity.UrlMiscInfoProperty, context);
            parameters[UploadItemToSignActivity.KeyOutAdobeAgreementIDProperty].AssignTo(activity, UploadItemToSignActivity.OutAdobeAgreementIDProperty, context);


            // TODO: Set standard context items for the workflow activity.
            activity.SetBinding(UploadItemToSignActivity.__ContextProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__context));
            activity.SetBinding(UploadItemToSignActivity.__ListItemProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__item));
            activity.SetBinding(UploadItemToSignActivity.__ListIdProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__list));

            // If this custom workflow action supports error handling,
            // add any necessary code here.

            // TODO: Add labels from the configuration to the workflow activity.
            ActivityFlags f = new ActivityFlags();

            f.AddLabelsFromConfig(context.Config);
            f.AssignTo(activity);

            // TODO: Add the workflow activity to the parent workflow activity for the context.
            context.ParentActivity.Activities.Add(activity);

            // store the fact that the word doc is signed or not
            // Utilities.AddESignStatusColumn(context.List);
            return(null);
        }
 internal DiscordActivity(ActivityModel model)
 {
     Name      = model.Name;
     Type      = model.Type;
     Url       = model.Url;
     CreatedAt = model.CreatedAt;
     if (model.Timestamps != null)
     {
         Timestamps = new DiscordActivityTimestamps(model.Timestamps);
     }
     ApplicationId = model.ApplicationId;
     Details       = model.Details;
     State         = model.State;
     if (model.Emoji != null)
     {
         Emoji = new DiscordActivityEmoji(model.Emoji);
     }
     if (model.Party != null)
     {
         Party = new DiscordActivityParty(model.Party);
     }
     if (model.Assets != null)
     {
         Assets = new DiscordActivityAssets(model.Assets);
     }
     if (model.Secrets != null)
     {
         Secrets = new DiscordActivitySecrets(model.Secrets);
     }
     Instance = model.Instance;
     Flags    = model.Flags;
 }
Beispiel #3
0
        public TrainActivities(string line, int offset)
        {
            _trainActivities = 0;
            if (line.Length - offset < 12)
            {
                throw new Exception($"Cannot construct a {this.GetType().ToString()} as the string supplied (length {line.Length}) minus the offset ({offset}) is not long enough.");
            }

            for (int i = 0; i < 6; ++i)
            {
                var activity = line.Substring(offset + i * 2, 2).Trim();
                switch (activity)
                {
                // pick up and set down passengers
                case "T":
                    _trainActivities |= ActivityFlags.Setdown | ActivityFlags.Pickup;
                    break;

                // setdown only - passengers are not permitted to board
                case "D":
                    _trainActivities |= ActivityFlags.Setdown;
                    break;

                // pickup only - passengers are not permitted to alight
                case "U":
                    _trainActivities |= ActivityFlags.Pickup;
                    break;
                }
            }
        }
Beispiel #4
0
        // TODO: Speed up rendering if possible
        public void Render()
        {
            lock (Application.DrawLock)
            {
                NeedsRender = false;

                _Activity = ActivityFlags.None;

                Graphics.DrawLine(new Point(0, 0), new Point(ConsoleHelper.Size.Width - 1, 0), ' ', ConsoleColor.DarkBlue);
                Graphics.WriteANSIString(new ANSIString(TitleBar), new Point(0, 0), ConsoleColor.DarkBlue, ConsoleColor.White);
                Graphics.DrawFilledBox(new Point(0, 1), new Point(ConsoleHelper.Size.Width - 1, ConsoleHelper.Size.Height - 2), ' ');

                using (var c = new CursorChanger(new Point(0, 1)))
                {
                    lock (_ChatBuf)
                    {
                        var rendered = RenderedMessages.ToArray();
                        var shown    = Math.Min(rendered.Length, Size.Height);

                        var scroll = Scroll;

                        for (int i = 0; i < shown; ++i)
                        {
                            var line = rendered[i + scroll];

                            Graphics.WriteANSIString(line.Value);

                            Console.CursorLeft = 0;
                            Console.CursorTop++;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public override CompositeActivity AddActivityToWorkflow(PublishContext context)
        {
            // Create an instance of the Activity and set its properties based on config. Add it to the parent activity.

            Dictionary <string, ActivityParameterHelper> parameters = context.Config.GetParameterHelpers();

            Activity activity = new Activity();

            //Assign values from the configuration.
            parameters[PSScriptProperty].AssignTo(activity, Activity.PSScriptProperty, context);
            parameters[ResultOutputProperty].AssignTo(activity, Activity.ResultOutputProperty, context);
            parameters[LoginUserNameProperty].AssignTo(activity, Activity.LoginUserNameProperty, context);
            parameters[LoginPasswordProperty].AssignTo(activity, Activity.LoginPasswordProperty, context);
            parameters[SSLEnabledProperty].AssignTo(activity, Activity.SSLEnabledProperty, context);
            parameters[ComputerNameProperty].AssignTo(activity, Activity.ComputerNameProperty, context);
            parameters[PortNumberProperty].AssignTo(activity, Activity.PortNumberProperty, context);
            parameters[AppNameProperty].AssignTo(activity, Activity.AppNameProperty, context);
            parameters[ShellUriProperty].AssignTo(activity, Activity.ShellUriProperty, context);

            // Set standard context items.
            activity.SetBinding(Activity.__ContextProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__context));
            activity.SetBinding(Activity.__ListItemProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__item));
            activity.SetBinding(Activity.__ListIdProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__list));

            ActivityFlags f = new ActivityFlags();

            f.AddLabelsFromConfig(context.Config);
            f.AssignTo(activity);

            context.ParentActivity.Activities.Add(activity);
            return(null);
        }
Beispiel #6
0
 public InteractionMode(string name, stringOrID prompt, Activity activity, stringOrID directive = default(stringOrID), ActivityFlags flags = ActivityFlags.SingleTop)
 {
     Name       = name;
     PromptText = prompt;
     Launches   = activity;
     Flags      = flags;
     Directive  = directive;
 }
Beispiel #7
0
        public ActivityInfo ToInfo()
        {
            ActivityFlags flags = ActivityFlags.None;

            if (ManuallyScheduled)
            {
                flags |= ActivityFlags.Manual;
            }
            if (Repeatable)
            {
                flags |= ActivityFlags.Repeatable;
            }
            if (IsExclusive)
            {
                flags |= ActivityFlags.Exclusive;
            }

            if (Duration >= 2)
            {
                if (Abbreviation == "HR" || Abbreviation == "RC")
                {
                    flags |= ActivityFlags.Excess;
                }
            }
            if (MaxConcurrent > 1 || MaxConcurrent == -1)
            {
                flags |= ActivityFlags.Concurrent;
            }
            if (MinDorms == 1)
            {
                flags |= ActivityFlags.SingleDorm;
            }
            if (MaxDorms > 1)
            {
                flags |= ActivityFlags.MultiDorm;
            }
            if (ExhaustionLevel >= 4)
            {
                flags |= ActivityFlags.Exhausting;
            }
            else if (ExhaustionLevel == 0)
            {
                flags |= ActivityFlags.Relaxing;
            }

            return(new ActivityInfo(
                       Name,
                       Abbreviation,
                       Priority,
                       ExhaustionLevel,
                       flags,
                       MaxDorms,
                       MinDorms,
                       Duration,
                       MaxConcurrent
                       ));
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Canceled)
            {
                // Notify user file picking was cancelled.
                OnFilePickCancelled();
                this.Finish();
            }
            else if (requestCode == READ_REQUEST_CODE && resultCode == Result.Ok)
            {
                try
                {
                    ActivityFlags takeFlags = data.Flags & (ActivityFlags.GrantReadUriPermission |
                                                            ActivityFlags.GrantWriteUriPermission);
                    this.context.ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);

                    FilePickerEventArgs args = new FilePickerEventArgs(data.Data.ToString(), this.GetFileName(data.Data), this.ReadData(data.Data));
                    OnFilePicked(args);
                }
                catch (Exception exc)
                {
                    System.Diagnostics.Debug.Write(exc);
                    // Notify user file picking failed.
                    OnFilePickCancelled();
                }
                finally
                {
                    this.Finish();
                }
            }
            else if (requestCode == WRITE_REQUEST_CODE && resultCode == Result.Ok)
            {
                try
                {
                    FilePickerEventArgs args = new FilePickerEventArgs(data.Data.ToString(), this.GetFileName(data.Data), this.data);
                    this.WriteData(data.Data);
                    OnFilePicked(args);
                }
                catch (Exception)
                {
                    // Notify user file picking failed.
                    OnFilePickCancelled();
                }
                finally
                {
                    this.Finish();
                }
            }
        }
Beispiel #9
0
        public ActivityInfo(string name, string abbrv, int basePriority, int exhaustionLevel, ActivityFlags flags = ActivityFlags.None, int maxD = 1, int minD = 1, int duration = 1, int maxConcurrent = 1) : base(ID_COUNTER, abbrv)
        {
            MinDorms      = minD;
            MaxDorms      = maxD;
            MaxConcurrent = maxConcurrent;
            Name          = name;
            //Zone = zone;
            Duration        = duration;
            Priority        = basePriority;
            ExhaustionLevel = exhaustionLevel;
            Flags           = flags;
            ++ID_COUNTER;
            IncompatibleActivities = new SortedSet <int>();

            if (!Flags.HasFlag(ActivityFlags.Manual))
            {
                if (Flags.HasFlag(ActivityFlags.Exclusive))
                {
                    ExclusiveActivityIDs.Add(ID);
                }
                else
                {
                    ActivityIDs.Add(ID);
                }

                if (Flags.HasFlag(ActivityFlags.Repeatable))
                {
                    RepeatableActivities.Add(ID);
                }

                if (Flags.HasFlag(ActivityFlags.MultiDorm))
                {
                    MultiDormActivities.Add(ID);
                    if (Flags.HasFlag(ActivityFlags.Concurrent) && abbrv == "GB")
                    {
                        Flags |= ActivityFlags.PriorityExclusive;
                    }
                }
            }

            if (Flags.HasFlag(ActivityFlags.Exhausting))
            {
                HighFatigueActivities.Add(ID);
            }
            else if (Flags.HasFlag(ActivityFlags.Relaxing))
            {
                LowFatigueActivities.Add(ID);
            }
        }
        private static Activity ConfigScreen(Activity activity, Type nextScreen, ActivityFlags flag)
        {
            if (nextScreen.IsNull())
            {
                return(null);
            }
            activity.RunOnUiThread(() =>
            {
                var intent = new Intent(activity, nextScreen);
                intent.AddFlags(flag);
                activity.StartActivity(intent);
            });

            return(activity);
        }
        /// <summary>
        /// Adds the Reply to the User's ActivityStream
        /// </summary>
        /// <param name="forumID">The forum unique identifier.</param>
        /// <param name="topicID">The topic unique identifier.</param>
        /// <param name="messageID">The message unique identifier.</param>
        /// <param name="topicTitle">The topic title.</param>
        /// <param name="message">The message.</param>
        public void AddReplyToStream(int forumID, long topicID, int messageID, string topicTitle, string message)
        {
            var flags = new ActivityFlags {
                CreatedReply = true
            };

            var activity = new Activity
            {
                Flags        = flags.BitValue,
                TopicID      = topicID.ToType <int>(),
                MessageID    = messageID,
                UserID       = forumID,
                Notification = false,
                Created      = DateTime.UtcNow
            };

            this.GetRepository <Activity>().Insert(activity);
        }
        /// <summary>
        /// The add thanks given to stream.
        /// </summary>
        /// <param name="userId">
        /// The user id.
        /// </param>
        /// <param name="topicId">
        /// The topic id.
        /// </param>
        /// <param name="messageId">
        /// The message id.
        /// </param>
        /// <param name="fromUserId">
        /// The from user id.
        /// </param>
        public void AddThanksGivenToStream(int userId, int topicId, int messageId, int fromUserId)
        {
            var flags = new ActivityFlags {
                GivenThanks = true
            };

            var activity = new Activity
            {
                Flags        = flags.BitValue,
                FromUserID   = fromUserId,
                TopicID      = topicId,
                MessageID    = messageId,
                UserID       = userId,
                Notification = false,
                Created      = DateTime.UtcNow
            };

            this.GetRepository <Activity>().Insert(activity);
        }
        public static void GoToScreen <T>(this Activity activity, bool finishActivity = false,
                                          ActivityFlags flag = ActivityFlags.NewTask | ActivityFlags.ClearTop, int animationRight = -1,
                                          int animationLeft  = -1)
        {
            activity.RunOnUiThread(() =>
            {
                if (finishActivity)
                {
                    activity.Finish();
                    activity.OverridePendingTransition(animationRight, animationLeft);
                    return;
                }

                var resultActivity = ConfigScreen(activity, typeof(T), flag);

                if (resultActivity != null && (animationLeft > -1 || animationRight > -1))
                {
                    resultActivity.OverridePendingTransition(animationRight, animationLeft);
                }
            });
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (requestCode == REQUEST_EXTERNAL_STORAGE_MANAGER)
            {
                AppFileUtil.UpdateIsExternalStorageManager();
                if (!AppFileUtil.IsExternalStorageManager)
                {
                    CheckStorageState();
                }
                UpdateLocalModule();
            }
            else if (resultCode == Result.Ok)
            {
                if (requestCode == AppStorageManager.OpenTreeRequestCode || requestCode == REQUEST_SELECT_DEFAULT_FOLDER)
                {
                    if (data == null || data.Data == null)
                    {
                        return;
                    }

                    Uri           uri       = data.Data;
                    ActivityFlags modeFlags = data.Flags & (ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission);
                    ContentResolver.TakePersistableUriPermission(uri, modeFlags);
                    LocalModule       localModule    = App.Instance().GetLocalModule(filter);
                    AppStorageManager storageManager = AppStorageManager.GetInstance(ApplicationContext);
                    if (TextUtils.IsEmpty(storageManager.DefaultFolder))
                    {
                        string defaultPath = AppFileUtil.ToPathFromDocumentTreeUri(uri);
                        storageManager.DefaultFolder = defaultPath;
                        App.Instance().CopyGuideFiles(localModule);
                        localModule.SetCurrentPath(defaultPath);
                    }
                    else
                    {
                        localModule.ReloadCurrentFilePath();
                    }
                }
            }
        }
        /// <summary>
        /// The add thanks received to stream.
        /// </summary>
        /// <param name="userId">
        /// The user id.
        /// </param>
        /// <param name="topicId">
        /// The topic id.
        /// </param>
        /// <param name="messageId">
        /// The message id.
        /// </param>
        /// <param name="fromUserId">
        /// The from user id.
        /// </param>
        public void AddThanksReceivedToStream(int userId, int topicId, int messageId, int fromUserId)
        {
            var flags = new ActivityFlags {
                ReceivedThanks = true
            };

            var activity = new Activity
            {
                Flags        = flags.BitValue,
                FromUserID   = fromUserId,
                TopicID      = topicId,
                MessageID    = messageId,
                UserID       = userId,
                Notification = true,
                Created      = DateTime.UtcNow
            };

            this.GetRepository <Activity>().Insert(activity);

            this.Get <IDataCache>().Remove(
                string.Format(Constants.Cache.ActiveUserLazyData, userId));
        }
Beispiel #16
0
        //TODO: Create  and Check the Column exists to store the transition key from adbe
        public override CompositeActivity AddActivityToWorkflow(PublishContext context)
        {
            // Prepare a keyed collection of ActivityParameterHelper objects.
            Dictionary <string, ActivityParameterHelper> parameters =
                context.Config.GetParameterHelpers();

            // TODO: Instantiate the workflow activity.
            DownloadDocumentActivity activity = new DownloadDocumentActivity();

            parameters[DownloadDocumentActivity.KeyAgreementID].AssignTo(activity, DownloadDocumentActivity.AgreementIDProperty, context);
            parameters[DownloadDocumentActivity.KeyDestWebUrl].AssignTo(activity, DownloadDocumentActivity.DestWebUrlProperty, context);
            parameters[DownloadDocumentActivity.KeyDestDocLib].AssignTo(activity, DownloadDocumentActivity.DestDocLibProperty, context);
            parameters[DownloadDocumentActivity.KeyDestDocName].AssignTo(activity, DownloadDocumentActivity.DestDocNameProperty, context);
            parameters[DownloadDocumentActivity.KeyOutDocumentID].AssignTo(activity, DownloadDocumentActivity.OutDocumentIDProperty, context);

            // TODO: Set standard context items for the workflow activity.
            activity.SetBinding(DownloadDocumentActivity.__ContextProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__context));
            activity.SetBinding(DownloadDocumentActivity.__ListItemProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__item));
            activity.SetBinding(DownloadDocumentActivity.__ListIdProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__list));

            // If this custom workflow action supports error handling,
            // add any necessary code here.

            // TODO: Add labels from the configuration to the workflow activity.
            ActivityFlags f = new ActivityFlags();

            f.AddLabelsFromConfig(context.Config);
            f.AssignTo(activity);

            // TODO: Add the workflow activity to the parent workflow activity for the context.
            context.ParentActivity.Activities.Add(activity);

            // on the list make sure the agreemntID column is added so that it can be updated by wF
            // if (!context.List.Fields.ContainsField(Constants.ColAgreementID))
            // context.List.Fields.Add(Constants.ColAgreementID, SPFieldType.Text, false);

            return(null);
        }
Beispiel #17
0
        //TODO: Create  and Check the Column exists to store the transition key from adbe
        public override CompositeActivity AddActivityToWorkflow(PublishContext context)
        {
            // Prepare a keyed collection of ActivityParameterHelper objects.
            Dictionary <string, ActivityParameterHelper> parameters =
                context.Config.GetParameterHelpers();

            // TODO: Instantiate the workflow activity.
            CheckAgreementStatusActivity activity = new CheckAgreementStatusActivity();

            parameters[CheckAgreementStatusActivity.KeyAgreementID].AssignTo(activity, CheckAgreementStatusActivity.AgreementIDProperty, context);
            parameters[CheckAgreementStatusActivity.KeyOutStaus].AssignTo(activity, CheckAgreementStatusActivity.StatusProperty, context);
            parameters[CheckAgreementStatusActivity.KeyOutPendingApprovers].AssignTo(activity, CheckAgreementStatusActivity.PendingApproversProperty, context);
            parameters[CheckAgreementStatusActivity.KeyOutEvents].AssignTo(activity, CheckAgreementStatusActivity.EventsProperty, context);


            // TODO: Set standard context items for the workflow activity.
            activity.SetBinding(CheckAgreementStatusActivity.__ContextProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__context));
            activity.SetBinding(CheckAgreementStatusActivity.__ListItemProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__item));
            activity.SetBinding(CheckAgreementStatusActivity.__ListIdProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__list));

            // If this custom workflow action supports error handling,
            // add any necessary code here.

            // TODO: Add labels from the configuration to the workflow activity.
            ActivityFlags f = new ActivityFlags();

            f.AddLabelsFromConfig(context.Config);
            f.AssignTo(activity);

            // TODO: Add the workflow activity to the parent workflow activity for the context.
            context.ParentActivity.Activities.Add(activity);

            // If this custom workflow action supports multiple output,
            // add any necessary code here.

            return(null);
        }
Beispiel #18
0
        public override CompositeActivity AddActivityToWorkflow(PublishContext context)
        {
            TaxonomyUpdateActivity activity = new TaxonomyUpdateActivity();

            Dictionary <string, ActivityParameterHelper> parameters = context.Config.GetParameterHelpers();

            parameters[Parameter_lookupList].AssignTo(activity, TaxonomyUpdateActivity.lookupListProperty, context);
            parameters[Parameter_itemID].AssignTo(activity, TaxonomyUpdateActivity.itemIDProperty, context);
            parameters[Parameter_FieldValue].AssignTo(activity, TaxonomyUpdateActivity.FieldValueProperty, context);
            parameters[Parameter_TaxonomyFieldName].AssignTo(activity, TaxonomyUpdateActivity.TaxonomyFieldNameProperty, context);

            activity.SetBinding(TaxonomyUpdateActivity.__ContextProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__context));
            activity.SetBinding(TaxonomyUpdateActivity.__ListItemProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__item));
            activity.SetBinding(TaxonomyUpdateActivity.__ListIdProperty, new ActivityBind(context.ParentWorkflow.Name, StandardWorkflowDataItems.__list));

            ActivityFlags f = new ActivityFlags();

            f.AddLabelsFromConfig(context);
            f.AssignTo(activity);

            context.ParentActivity.Activities.Add(activity);

            return(null);
        }
Beispiel #19
0
 public override void SendMessage(int iOperation, XLANGMessage msg, Correlation[] initCorrelations, Correlation[] followCorrelations, Context cxt, Segment seg, ActivityFlags flags)
 {
     throw new NotImplementedException();
 }
 public ActivityPresenterInfo(Type activityType, ActivityFlags flags = 0)
 {
     ActivityType = activityType;
     Flags        = flags;
 }
        internal static void SwitchToActivity <T>(this ContextWrapper contextWrapper, ActivityFlags flags) where T : BaseActivity
        {
            Intent intent = new Intent(contextWrapper, typeof(T));

            intent.SetFlags(flags);
            contextWrapper.StartActivity(intent);
        }
Beispiel #22
0
		// TODO: Speed up rendering if possible
        public void Render()
        {
            lock (Application.DrawLock)
            {
                RenderMessages();

                _Activity = ActivityFlags.None;

                Graphics.DrawLine(new Point(0, 0), new Point(ConsoleHelper.Size.Width - 1, 0), ' ', ConsoleColor.DarkBlue);
                Graphics.WriteANSIString(TitleBar, new Point(0, 0), ConsoleColor.DarkBlue, ConsoleColor.White);
                Graphics.DrawFilledBox(new Point(0, 1), new Point(ConsoleHelper.Size.Width - 1, ConsoleHelper.Size.Height - 2), ' ');

                int height = ConsoleHelper.Size.Height - 4;
                int totalHeight = 0;

                // TODO Scrolling

                using (var c = new CursorChanger(new Point(0, 1)))
                {
					lock(_ChatBuf)
                    foreach (var msg in Messages
                        .Reverse()
                        .TakeWhile(p => (totalHeight += p.Lines) < height)
                        .Reverse()
                        .Skip(totalHeight > height ? 1 : 0))
                    {
                        if (msg.Timestamp.Date == DateTime.Now.Date)
                            Graphics.WriteANSIString($"[{msg.Timestamp.ToString("HH:mm")}] ".Color(ConsoleColor.Gray));
                        else
                            Graphics.WriteANSIString($"[{msg.Timestamp.ToString("yyyy-MM-dd")}] ".Color(ConsoleColor.Gray));

                        string message = msg[MessageDisplay];
                        bool action = message.StartsWith("/me", StringComparison.CurrentCultureIgnoreCase);
                        if (action)
                            Console.Write("* ");

                        if (msg.Sender?.Name != null)
                            Graphics.WriteANSIString(msg.Sender.ToANSIString(Channel, true));
                        else
                            Graphics.WriteANSIString("System".Color(ConsoleColor.DarkGray));

                        if (action)
                        {
                            if (msg.PlainMessage.StartsWith("/me's", StringComparison.CurrentCultureIgnoreCase))
                            {
                                Graphics.WriteANSIString(message.Substring(3), foreground: ConsoleColor.White);
                            }
                            else
                            {
                                Console.CursorLeft++;
                                Graphics.WriteANSIString(message.Substring(4), foreground: ConsoleColor.White);
                            }
                        }
                        else
                            Graphics.WriteANSIString(": " + message, foreground: ConsoleColor.Gray);

                        Console.CursorLeft = 0;
                        Console.CursorTop++;
                    }
                }
            }
        }
Beispiel #23
0
        public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null)
        {
            Intent i = new Intent(act, typeof(EntryActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());
            i.PutExtra(KeyRefreshPos, pos);

            if (flags != null)
                i.SetFlags((ActivityFlags) flags);

            appTask.ToIntent(i);
            if (flags != null && (((ActivityFlags) flags) | ActivityFlags.ForwardResult) == ActivityFlags.ForwardResult)
                act.StartActivity(i);
            else
                act.StartActivityForResult(i, 0);
        }
Beispiel #24
0
 public static Intent addFlags(this Intent intent, ActivityFlags flags)
 {
     return(intent.AddFlags(flags));
 }
Beispiel #25
0
        /// <summary>
        ///  This method is used to declare a new tag type and register it with our dictionary so it can be located by name later.
        /// </summary>
        /// <param name="name">The name you'll refer to this tag type by.  Used mostly as a dictionary key.</param>
        /// <param name="promptString">A string, or resource ID, for a "what to do with this" prompt.  May become obsolete.</param>
        /// <param name="activity">An activity, usually a new instance of (the specific Activity-derived class) you want such tags to launch.</param>
        /// <param name="directive">Any additional information you wish to bundle up and include when the Activity is being launched (like "calibration" rather than the real thing) should be stringified into this.</param>
        /// <param name="flags">Android ActivityFlag(s) describing how the launched activity behaves - does it claim the foreground (the default), does it move straight to background, etc.</param>
        /// <returns></returns>
        public static InteractionMode DefineInteractionMode(string name, stringOrID promptString, Activity activity, stringOrID directive = default(stringOrID), ActivityFlags flags = ActivityFlags.SingleTop)
        {
            var             direc   = (stringOrID)directive;
            InteractionMode newMode = new InteractionMode
            {
                Name       = name,
                PromptText = promptString,
                Launches   = activity,
                Directive  = direc,
                Flags      = flags
            };

            if (InteractionModes.ContainsKey(name))
            {
                InteractionModes[name] = newMode;
            }
            else
            {
                InteractionModes.Add(name, newMode);
            }
            return(newMode);
        }