Exemplo n.º 1
0
        /// <summary>
        /// Constructor Note Window - Show Note and Editable Note
        /// </summary>
        /// <param name="note"></param>
        /// <param name="listTagsOfNote"></param>
        /// <param name="listAllTags"></param>
        public NoteWindow(Note note, IEnumerable <Tag> listTagsOfNote, IEnumerable <Tag> listAllTags)
        {
            InitializeComponent();

            editableNote = note;
            colorTag     = note.ColorNote;
            if (this != null)
            {
                this.Background = new SolidColorBrush(colorsBackground[(int)colorTag]);
            }

            titleNote.Text = note.Title;
            ByteArrayToFlowDocument converter = new ByteArrayToFlowDocument();

            contentNote.Document = converter.Convert(note.Document, null, null, null) as FlowDocument;

            noteTags = new ObservableCollection <QuickNote.Tag>(listAllTags);

            foreach (var tag in listTagsOfNote)
            {
                Tag res = null;
                res = noteTags.FirstOrDefault(x => x.Id == tag.Id);
                if (res != null)
                {
                    res.IsSelected = true;
                }
            }

            if (lstTags != null)
            {
                lstTags.DataContext = new TagsViewModelLstBox(noteTags);
            }
            UpdateTagNoteText();

            titleWindow.Text = "Edit Note";

            foreach (object child in groupColorPicker.Children)
            {
                if (child is RadioButton)
                {
                    RadioButton pick     = child as RadioButton;
                    ColorTag    colorBtn = (ColorTag)Int32.Parse(pick.Tag as string);

                    if (colorBtn == colorTag)
                    {
                        pick.IsChecked = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor Note Window - Show Note Only Not Editable
        /// </summary>
        /// <param name="note"></param>
        public NoteWindow(Note note, IEnumerable <Tag> listTagsOfNote)
        {
            InitializeComponent();

            colorTag = note.ColorNote;
            if (this != null)
            {
                this.Background = new SolidColorBrush(colorsBackground[(int)colorTag]);
            }

            settingBtn.IsEnabled  = false;
            settingBtn.Visibility = Visibility.Collapsed;
            addBtn.IsEnabled      = false;
            addBtn.Visibility     = Visibility.Collapsed;
            addBtnImg.Visibility  = Visibility.Collapsed;

            btnsControlNewNote.Visibility  = Visibility.Collapsed;
            btnsControlShowNote.Visibility = Visibility.Visible;

            titleNote.Text       = note.Title;
            titleNote.IsReadOnly = true;

            ByteArrayToFlowDocument converter = new ByteArrayToFlowDocument();

            contentNote.Document   = converter.Convert(note.Document, null, null, null) as FlowDocument;
            contentNote.IsReadOnly = true;

            string tagsName = "";
            bool   first    = false;

            foreach (var tag in listTagsOfNote)
            {
                if (first)
                {
                    tagsName += ", ";
                }
                tagsName += tag.Name;
                first     = true;
            }

            tagNote.Text = tagsName;

            titleWindow.Text = "Show Note";
        }