Example #1
0
        private bool GetChatCollection(out IEnumerator enumerator)
        {
            enumerator = null;

            IChatCollection chatCollection;

            Dispatcher.Invoke(new Action(
                                  () => bottomInfoLabel.Content = waitingForSkypeString));
            Thread.Sleep(100); // I don't understand why, but it helps to "unhang" showing this page.
            Logger.Info("Awaiting for Skype response ...");
            if (!SafeInvoker.Repeat(() => Context.Skype.Chats,
                                    out chatCollection, 3))
            {
                return(false);
            }
            int chatCount;

            if (!SafeInvoker.Invoke(() => chatCollection.Count, out chatCount))
            {
                return(false);
            }
            Context.ChatCount = chatCount;
            int messagesCount;

            // ReSharper disable UseIndexedProperty
            // Because indexed property fail an installer building.
            if (!SafeInvoker.Invoke(() => Context.Skype.get_Messages(String.Empty).Count,
                                    // ReSharper restore UseIndexedProperty
                                    out messagesCount))
            {
                return(false);
            }
            Context.MessagesCount = messagesCount;
            Logger.Info("{0} chat(s) and {1} messages found.", chatCount, messagesCount);
            return(SafeInvoker.Invoke(chatCollection.GetEnumerator,
                                      out enumerator));
        }