Beispiel #1
0
        private void LoadFromState()
        {
            ReplyViewModelState state = CoreExtensions.LoadFromFile <ReplyViewModelState>("reply.xml");

            if (state != null)
            {
                IThreadPostRequest request = state.IsEditRequest
                    ? new ThreadPostMetadata()
                {
                    PostID = state.PostId
                }.BeginEdit()
                    : new ThreadMetadata()
                {
                    ThreadID = state.ThreadId
                }.CreateReplyRequest();

                request.Content = state.Content;
                this.Request    = request;
            }
        }
Beispiel #2
0
        public void SaveCurrentState()
        {
            try
            {
                ReplyViewModelState state = new ReplyViewModelState();
                state.Content       = this.Text;
                state.IsEditRequest = this.Request.RequestType == PostRequestType.Edit;
                if (state.IsEditRequest)
                {
                    state.PostId = (this.Request as ThreadPostEditRequest).Post.PostID;
                }
                else
                {
                    state.ThreadId = (this.Request as ThreadReplyRequest).Thread.ThreadID;
                }

                state.SaveToFile("reply.xml");

                Notification.Show("Draft saved.", "Save Draft");
            }

            catch (Exception ex) { AwfulDebugger.AddLog(this, AwfulDebugger.Level.Critical, ex); }
        }
Beispiel #3
0
        public void SaveCurrentState()
        {
            try
            {
                ReplyViewModelState state = new ReplyViewModelState();
                state.Content = this.Text;
                state.IsEditRequest = this.Request.RequestType == PostRequestType.Edit;
                if (state.IsEditRequest)
                    state.PostId = (this.Request as ThreadPostEditRequest).Post.PostID;
                else
                    state.ThreadId = (this.Request as ThreadReplyRequest).Thread.ThreadID;

                state.SaveToFile("reply.xml");

                Notification.Show("Draft saved.", "Save Draft");
            }

            catch (Exception ex) { AwfulDebugger.AddLog(this, AwfulDebugger.Level.Critical, ex); }
        }