Пример #1
0
        public static void SaveState(ThreadRequestViewModel viewModel)
        {
            if (viewModel != null)
            {
                var save = new ThreadRequestState();
                if (viewModel.Request != null)
                {
                    save.RequestText = viewModel.Request.Text;
                    save.RequestTitle = viewModel.Request.Title;
                    save.SelectedIconIndex = viewModel.Request.Icons.IndexOf(
                        viewModel.Request.SelectedIcon);
                }

                if (viewModel.Forum != null) { save.ForumID = viewModel.Forum.ID; }

                save.SeralizeToFile(Globals.Constants.STATE_DIRECTORY, "thread_request.state");
            }
        }
Пример #2
0
        public NewThread()
        {
            InitializeComponent();
            BindEvents();

            InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem));
            InteractionEffectManager.AllowedTypes.Add(typeof(RadListPicker));
            InteractionEffectManager.AllowedTypes.Add(typeof(RadListPickerItem));

            this._context = this.LayoutRoot.DataContext as ViewModels.ThreadRequestViewModel;

            if (this._context == null)
                throw new Exception("DataContext should not be null.");

            this._tagSource = new AwfulTextBoxTagOptionAdapter(this.ThreadTextBox, this.tagOptions, this._context.Tags);

            this._previewContext = new ViewModels.ThreadRequestPreviewViewModel();
            this.PreviewViewer.SetViewModel(this._previewContext);
            this.PreviewViewer.PageHeaderPanel.Visibility = System.Windows.Visibility.Collapsed;
            this._defaultBar = this.ApplicationBar;
        }