Esempio n. 1
0
        private void SaveOutboxLocal()
        {
            string folder = DataFolder.CombinePath(UserAddress);

            EnsureCreateFolder(folder);
            string path = folder.CombinePath("Out.bin");

            EnsureCreateFile(path);
            SerializeAssistant.Serialize(path, OutboxList);
        }
Esempio n. 2
0
        protected override void Init()
        {
            //Ensure local path created.
            DataFolder   = AppDomain.CurrentDomain.BaseDirectory + "Data";
            DraftFolder  = DataFolder + "\\Draft";
            InboxFolder  = DataFolder + "\\Inbox";
            draftBinPath = DraftFolder.CombinePath("Draft.bin");
            UserBinPath  = DataFolder.CombinePath("User.bin");
            EnsureCreateFolder(DataFolder);
            EnsureCreateFolder(DraftFolder);
            EnsureCreateFolder(InboxFolder);
            EnsureCreateFile(UserBinPath);
            //Get stored data
            userAssistant = new UserAssistant(UserBinPath);
            var obj = SerializeAssistant.Deserialize(draftBinPath);

            if (null != obj)
            {
                BindingList <MailBase> drafts = null;
                drafts = obj as BindingList <MailBase>;
                if (drafts != null)
                {
                    DraftList = drafts;
                }
            }
            UpdateSettings(UseImap);
            //Init commands.
            LoginCommand = new RelayCommand <object>(Login, o =>
            {
                return(!(IsLogined || string.IsNullOrEmpty(UserAddress) || IsRequesting));
            });
            LoginIfAutoCommand          = new RelayCommand <object>(CheckAutoLogin, o => !IsLogined);
            LogoutCommand               = new RelayCommand(Logout, () => IsLogined);
            GetInboxMailCommand         = new RelayCommand(GetInboxMail, () => IsLogined && !IsRequesting);
            ReplyCommand                = new RelayCommand <object>(ReplyMailFrom);
            ForwardCommand              = new RelayCommand <object>(ForwardTo);
            AddNewDraftCommand          = new RelayCommand <object>(NavigateNewDraft);
            DeleteDraftCommand          = new RelayCommand <object>(DeleteDraft);
            SaveAttachmentCommand       = new RelayCommand <object>(SaveAttachmentAs);
            DeleteOutboxMailCommand     = new RelayCommand <object>(DeleteOutboxMail);
            DeleteInboxMailCommand      = new RelayCommand <object>(DeleteInboxMail, o => !IsRequesting);
            ForgetUserCommand           = new RelayCommand <object>(RemoveLocalUserActon, o => IsLogined);
            RemoveUserFromRecentCommand = new RelayCommand <object>(RemoveUserFromRecentAction);
            NavigationInMainCommand     = new RelayCommand <object>(Navigate);
        }