public UpdateMessageStateTask(ChannelConfiguration config, IReadStateChannel channel, List<ChannelFolder> availableFolders, Message message)
 {
     this.config = config;
     this.channel = channel;
     this.availableFolders = availableFolders;
     this.message = message;
 }
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folders = new List<ChannelFolder>();
 }
 public ValidateLoginTask(ChannelConfiguration configuration, IClientInputChannel channel)
     : base(configuration, channel)
 {
     this.configuration = configuration;
     this.channel = channel;
     this.context = new SetupChannelClientContext();
 }
 public ReceiveMessageDetailsTask(ChannelConfiguration config, IClientInputChannel channel, ChannelMessageHeader header, ChannelFolder folder)
 {
     this.config = config;
     this.channel = channel;
     this.header = header;
     this.folder = folder;
 }
        /// <summary>
        /// Adds the specified channel.
        /// </summary>
        /// <param name="channel">The channel.</param>
        public static ChannelInstance Add(ChannelConfiguration channel)
        {
            var channelInstance = new ChannelInstance(channel);

            _Channels.Add(channelInstance);

            return channelInstance;
        }
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folders = new List<ChannelFolder>();
     this.dataService = ClientState.Current.DataService;
 }
 public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folder = folder;
     this.range = range;
     this.dataService = ClientState.Current.DataService;
 }
        public ChannelSetupRedirectWindow(ChannelConfiguration configuration, bool isCloudChannel)
        {
            this.configuration = configuration;
            this.isCloudChannel = isCloudChannel;
            this.builder = configuration.RedirectBuilder;

            InitializeComponent();

            DataContext = this;
        }
        public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
            : base(config, channel)
        {
            this.config = config;
            this.channel = channel;
            this.folder = folder;
            this.range = range;

            mailbox = VirtualMailBox.Current;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelSetupControl"/> class.
        /// </summary>
        /// <param name="channelConfiguration">The channel configuration.</param>
        public ChannelSetupControl(ChannelConfiguration channelConfiguration)
        {
            ChannelConfiguration = channelConfiguration;

            InitializeComponent();

            // Set Header
            TitleTextBlock.Text =
                channelConfiguration.DisplayStyle == DisplayStyle.Other ?
                "Configure your own IMAP or POP3 account" :
                string.Format("Login to {0}", channelConfiguration.DisplayName);

            DataContext = this;
        }
        public ChannelProfileControl(Person person, Profile profile, ChannelConfiguration channel)
        {
            InitializeComponent();

            DataContext = this;

            Person = person;
            Profile = profile;
            Channel = channel;

            if (Channel.Charasteristics.SupportsStatusUpdates)
            {
                // Execute task to get latest status update for this user
                var task = new GetLastUserStatusTask(Channel,
                    ChannelsManager.GetChannelObject(Channel.ChannelId).StatusUpdatesChannel, Profile.SourceAddress);

                task.FinishedSuccess += GetLastUserStatusTask_Finished;
                task.FinishedFailure += GetLastUserStatusTask_FinishedFailure;
                task.ExecuteAsync();

                // Start loader animation
                ((Storyboard)FindResource("RunLoaderStoryboard")).Begin();
            }
        }
 public EnumerateLabelsFolderTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
 }
 public UserStatusParser(ChannelConfiguration config)
 {
     this.config = config;
     this.mailbox = VirtualMailBox.Current;
 }
Beispiel #14
0
        void LoadChannelConfigs()
        {
            if (!configLoaded)
            {
                if (SourceChannelId > 0)
                {
                    var channel = ChannelsManager.GetChannelObject(SourceChannelId);

                    if (channel != null)
                        sourceChannelConfig = channel.Configuration;
                }

                if (TargetChannelId > 0)
                {
                    var channel = ChannelsManager.GetChannelObject(TargetChannelId);

                    if (channel != null)
                        targetChannelConfig = channel.Configuration;
                }

                configLoaded = true;
            }
        }
 public UserStatusParser(ChannelConfiguration config)
 {
     this.dataService = ClientState.Current.DataService;
     this.config = config;
 }
        void SendCloudMessage(ChannelConfiguration channel, ChannelMessage message)
        {
            var data = String.Format("wrap_access_token={0}&targetchannelkey={1}&from={2}&to={3}&cc={4}&bcc={5}&subject={6}&inreplyto={7}&conversationidentifier={8}&body={9}",
                CloudApi.AccessToken,
                channel.ChannelKey,
                HttpUtility.UrlEncode(message.From.ToString()),
                HttpUtility.UrlEncode(message.To.ToString()),
                HttpUtility.UrlEncode(message.CC.ToString()),
                HttpUtility.UrlEncode(message.BCC.ToString()),
                HttpUtility.UrlEncode(message.Context),
                HttpUtility.UrlEncode(message.InReplyTo),
                HttpUtility.UrlEncode(message.ConversationId),
                HttpUtility.UrlEncode(message.BodyHtml.ReadString()));

            string messageKey;

            if (message.Attachments.Count > 0)
            {
                var files = message.Attachments
                    .Select(s => new UploadFile(s.ContentStream, s.Filename, "application/octet-stream"))
                    .ToList();

                messageKey = HttpServiceRequest.Post(String.Concat(CloudApi.ApiBaseUrl, "send/message"), data, files, true);
            }
            else
            {
                messageKey = HttpServiceRequest.Post(String.Concat(CloudApi.ApiBaseUrl, "send/message"), data, true);
            }

            // Update messagekey
            this.message.MessageKey = messageKey;

            ClientState.Current.DataService.Update(this.message);
        }
 public ProcessLabelsTask(ChannelConfiguration config)
 {
     this.config = config;
 }
Beispiel #18
0
        void ReceiveFoldersTask_FinishedSuccess(ReceiveFoldersTask foldersTask, ChannelConfiguration config, IClientInputChannel inputChannel)
        {
            var gate = new ConcurrencyGate(config.InputChannel.MaxConcurrentConnections);
            var folders = foldersTask.Folders.OrderByDescending(f => (int) f.FolderType);
            var group = new ProgressGroup { SourceChannelId = config.ChannelId };

            // Folders are pushed by descending order into concurrency gate and then popped again,
            // this way the Inbox folder is processed before the sent items folder etc.
            foreach (var folder in folders)
            {
                if (folder.FolderType == ChannelFolderType.Inbox
                    || folder.FolderType == ChannelFolderType.SentItems)
                {
                    gate.Add(new ReceiveMessagesTask(config, inputChannel.Clone(), folder, range));
                }
                else if (folder.FolderType == ChannelFolderType.Trash || folder.FolderType == ChannelFolderType.Spam)
                {
                    gate.Add(new EnumerateMessagesFolderTask(config, inputChannel.Clone(), folder, range) { ProgressGroup = group });
                }
                else if (folder.FolderType == ChannelFolderType.Label)
                {
                    if (config.Charasteristics.SupportsLabels)
                        gate.Add(new EnumerateLabelsFolderTask(config, inputChannel.Clone(), folder, range) { ProgressGroup = group });
                }
            }

            gate.Execute();
            group.IsCompleted = true;

            // Process any labels that we might have received
            if (config.Charasteristics.SupportsLabels)
                new ProcessLabelsTask(config).Execute();

            if (inputChannel is IPoolableChannel)
                ((IPoolableChannel)inputChannel).FreeAllConnections();
        }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChannelTask"/> class.
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="channel">The channel.</param>
 protected ChannelTask(ChannelConfiguration configuration, IClientChannel channel)
 {
     this.channel = channel;
     this.configuration = configuration;
 }
        public static string GetChannelColor(ChannelConfiguration config)
        {
            var properties = _ChannelProperties.FirstOrDefault(c => c.Name == config.DisplayName);

            return properties == null ? "#124" : String.IsNullOrEmpty(properties.PreferedColour) ? "#124" : properties.PreferedColour;
        }
        /// <summary>
        /// Edits the channel.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        void EditChannel(ChannelConfiguration configuration)
        {
            if (configuration != null)
            {
                ChannelSetupControlPanel.Children.Clear();

                // Setup Control
                ChannelSetupControl setupControl = new ChannelSetupControl(configuration.Clone());
                setupControl.IsInEditModus = true;
                setupControl.Username = configuration.InputChannel.Authentication.Username;
                setupControl.HorizontalAlignment = HorizontalAlignment.Center;
                setupControl.VerticalAlignment = VerticalAlignment.Center;
                setupControl.OnValidationFinished += OnValidationFinishedHandler;
                setupControl.OnCancel += OnCancelHandler;
                setupControl.RenderTransform = new TranslateTransform(0, 0);

                ChannelSetupControlPanel.Children.Add(setupControl);

                // Play Animation
                var firstItem = (FrameworkElement)transitionContainer.Items[0];
                var secondItem = (FrameworkElement)transitionContainer.Items[1];

                FlipTransition transition = Resources["FlipTransition"] as FlipTransition;
                transition.Rotation = Direction.RightToLeft;
                transitionContainer.Transition = transition;
                transitionContainer.TransitionCompleted -= OnTransitionCompleted;
                transitionContainer.ApplyTransition(firstItem, secondItem);

                OnPropertyChanged("AllChannelConfigurations");
                OnPropertyChanged("ChannelConfiguration");
            }
        }
        public static string GetChannelHelpUrl(ChannelConfiguration config)
        {
            var properties = _ChannelProperties.FirstOrDefault(c => c.Name == config.DisplayName);

            return properties == null ? String.Empty : properties.HelpUrl;
        }
 public SyncContactsTask(ChannelConfiguration config, IClientContactsChannel channel)
 {
     this.config = config;
     this.channel = channel;
 }
 public SyncStatusUpdatesTask(ChannelConfiguration config, IClientStatusUpdatesChannel channel)
 {
     this.config = config;
     this.channel = channel;
 }
 public UserStatusParser(ChannelConfiguration config, string searchKeyword)
     : this(config)
 {
     this.searchKeyword = searchKeyword;
 }
 public EnumerateLabelsFolderTask(List<Message> changed, ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
     this.changed = changed;
 }
 public RemoveChannelTask(ChannelConfiguration configuration)
     : this(configuration, true)
 {
 }
 public ProcessLabelsTask(List<Message> changed, ChannelConfiguration config)
 {
     this.changed = changed;
     this.config = config;
     this.dataService = ClientState.Current.DataService;
 }
 public SyncCalendarTask(ChannelConfiguration config, IClientCalendarChannel channel)
 {
     this.config = config;
     this.channel = channel;
 }
 public RemoveChannelTask(ChannelConfiguration configuration, bool notify)
 {
     this.configuration = configuration;
     this.mailbox = VirtualMailBox.Current;
     this.notify = notify;
 }