Exemple #1
0
        private void applyAppearanceAdjustment(NoteAppearanceAdjustedEventArgs e)
        {
            try
            {
                var note = getSelectedNote();
                if (note == null) return;
                var isDialog = note.Visible && note.Dialog != null;
                note.Opacity = e.Opacity;
                note.CustomOpacity = e.CustomOpacity;
                if (isDialog)
                {
                    note.Dialog.Opacity = note.Opacity;
                }
                PNNotesOperations.SaveNoteOpacity(note);

                if (e.CustomSkinless)
                {
                    note.Skinless = (PNSkinlessDetails)e.Skinless.Clone();
                    if (!PNStatic.Settings.GeneralSettings.UseSkins && isDialog)
                    {
                        note.Dialog.PHeader.SetPNFont(note.Skinless.CaptionFont);
                        note.Dialog.Foreground = new SolidColorBrush(note.Skinless.CaptionColor);
                        note.Dialog.Background = new SolidColorBrush(note.Skinless.BackColor);
                    }
                }
                else
                {
                    note.Skinless = null;
                    var group = PNStatic.Groups.GetGroupByID(note.GroupID);
                    if (group != null)
                    {
                        if (!PNStatic.Settings.GeneralSettings.UseSkins && isDialog)
                        {
                            note.Dialog.PHeader.SetPNFont(group.Skinless.CaptionFont);
                            note.Dialog.Foreground = new SolidColorBrush(group.Skinless.CaptionColor);
                            note.Dialog.Background = new SolidColorBrush(group.Skinless.BackColor);
                        }
                    }
                }
                PNNotesOperations.SaveNoteSkinless(note);

                if (e.CustomSkin)
                {
                    note.Skin = e.Skin.PNClone();
                    if (PNStatic.Settings.GeneralSettings.UseSkins && isDialog)
                    {
                        PNSkinsOperations.ApplyNoteSkin(note.Dialog, note);
                    }
                }
                else
                {
                    note.Skin = null;
                    var group = PNStatic.Groups.GetGroupByID(note.GroupID);
                    if (group != null)
                    {
                        if (PNStatic.Settings.GeneralSettings.UseSkins && isDialog)
                        {
                            PNSkinsOperations.ApplyNoteSkin(note.Dialog, note);
                        }
                    }
                }
                PNNotesOperations.SaveNoteSkin(note);
                loadNotePreview(note);
            }
            catch (Exception ex)
            {
                PNStatic.LogException(ex);
            }
        }
Exemple #2
0
 private void dlgAdjustAppearance_NoteAppearanceAdjusted(object sender, NoteAppearanceAdjustedEventArgs e)
 {
     try
     {
         var dlgAdjustAppearance = sender as WndAdjustAppearance;
         if (dlgAdjustAppearance != null)
             dlgAdjustAppearance.NoteAppearanceAdjusted -= dlgAdjustAppearance_NoteAppearanceAdjusted;
         applyAppearanceAdjustment(e);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }