コード例 #1
0
        public void Filter(string message, IChatWindow window, FilterDirection direction, Action <string> onAccept)
        {
            var filteredMessage = new StringBuilder(message);

            if (Filter(filteredMessage, window, direction))
            {
                onAccept(filteredMessage.ToString());
            }
        }
コード例 #2
0
        private void SendMessageMenu_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable <Buddy> buddies = SquiggleUtility.SelectContacts(Translation.Instance.ContactSelectWindow_Heading_InstantMessage, this);

            if (buddies.Any())
            {
                Buddy       buddy      = buddies.First();
                IChatWindow chatWindow = StartChat(buddy);
                chatWindow.Invite(buddies.Except(new[] { buddy }));
            }
        }
コード例 #3
0
        public bool Filter(StringBuilder message, IChatWindow window, FilterDirection direction)
        {
            foreach (IMessageFilter filter in this.Where(f => (f.Direction & direction) == direction))
            {
                if (!filter.Filter(message, window))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        public bool Filter(StringBuilder message, IChatWindow window)
        {
            string       text    = message.ToString();
            IChatCommand command = commands.FirstOrDefault(cmd => cmd.IsMatch(text));

            if (command == null)
            {
                return(true);
            }

            command.Execute(text, window, SquiggleContext.Current);

            return(false);
        }
コード例 #5
0
ファイル: AliasFilter.cs プロジェクト: dugu01/squiggle
        public bool Filter(StringBuilder message, IChatWindow window)
        {
            message.Replace("(you)", window.PrimaryBuddy.DisplayName)
            .Replace("(me)", SquiggleContext.Current.ChatClient.CurrentUser.DisplayName)
            .Replace("(now)", DateTime.Now.ToString())
            .Replace("(time)", DateTime.Now.ToLongTimeString())
            .Replace("(stime)", DateTime.Now.ToShortTimeString())
            .Replace("(date)", DateTime.Now.ToShortDateString())
            .Replace("(day)", DateTime.Now.DayOfWeek.ToString())
            .Replace("(myip)", (NetworkUtility.GetLocalIPAddress() ?? IPAddress.Loopback).ToString())
            .Replace("(ver)", AppInfo.Version.ToString());

            return(true);
        }
コード例 #6
0
        public void Register(IChatWindow chatWindow)
        {
            if (chatWindow == null)
            {
                throw new ArgumentNullException(nameof(chatWindow));
            }

            if (m_ChatWindow != null)
            {
                throw new InvalidOperationException("There is already an instance of IChatWindow registered");
            }

            m_ChatWindow = chatWindow;
        }
コード例 #7
0
        IChatWindow StartChat(IBuddy buddy, bool sendFile, params string[] filePaths)
        {
            IChatWindow window = StartChat(buddy);

            if (sendFile)
            {
                if (filePaths == null || filePaths.Length == 0)
                {
                    window.SendFile();
                }
                else
                {
                    window.SendFiles(filePaths);
                }
            }

            return(window);
        }
コード例 #8
0
ファイル: VoiceChatActivity.cs プロジェクト: dugu01/squiggle
 public Task <IDictionary <string, object> > LaunchInviteUI(ISquiggleContext context, IChatWindow window)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
        public override async Task <IDictionary <string, object> > LaunchInviteUI(ISquiggleContext context, IChatWindow window)
        {
            string fileName = String.Format("Screenshot_{0:yyMMddHHmmss}.jpg", DateTime.Now);

            var chatWindow = ((Window)window);

            chatWindow.WindowState = WindowState.Minimized;

            await Task.Delay(1.Seconds());

            Stream stream = CaptureScreen();

            window.Restore();

            var args = new Dictionary <string, object>()
            {
                { "name", fileName },
                { "content", stream },
                { "size", stream.Length }
            };

            stream.Seek(0, SeekOrigin.Begin);

            return(args);
        }
コード例 #10
0
 public void Unregister()
 {
     m_ChatWindow = null;
 }