示例#1
0
 internal static PNSkinDetails GetSkin(WndNote dlg, PNote note)
 {
     try
     {
         PNSkinDetails skn;
         if (note.Skin != null)
         {
             skn = note.Skin;
         }
         else
         {
             PNGroup gr = PNStatic.Groups.GetGroupByID(note.GroupID);
             if (gr.Skin == null || gr.Skin.SkinName == PNSkinDetails.NO_SKIN)
             //if (gr.ID != (int)SpecialGroups.Docking && gr.ID != (int)SpecialGroups.Diary)
             {
                 // get General png skin
                 gr = PNStatic.Groups.GetGroupByID(0);
             }
             skn = gr.Skin;
         }
         return(skn);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
         return(null);
     }
 }
示例#2
0
 internal static void ApplyNoteSkin(WndNote dlg, PNote note, bool fromLoad = false)
 {
     try
     {
         PNSkinDetails skn = GetSkin(dlg, note);
         if (skn != null && skn.BitmapSkin != null)
         {
             if (dlg.Equals(note.Dialog))
             {
                 dlg.Hide();
             }
             dlg.SetRuntimeSkin(skn.PNClone(), fromLoad);
             if (dlg.Equals(note.Dialog))
             {
                 dlg.Show();
             }
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
        private bool preSaveMenus(MenuType type, TreeView tvw)
        {
            try
            {
                foreach (var pti in tvw.Items.OfType <PNTreeItem>())
                {
                    fillNodesList(pti, _OrderLists[type].Item2, _HiddenLists[type].Item2);
                }
                if (_OrderLists[type].Item1.Where((t, i) => t != _OrderLists[type].Item2[i]).Any())
                {
                    foreach (var pti in tvw.Items.OfType <PNTreeItem>())
                    {
                        createOrderSql(pti);
                    }
                    switch (type)
                    {
                    case MenuType.Main:
                        _MenusOrderChanged.Main = true;
                        break;

                    case MenuType.Note:
                    {
                        var d = new WndNote();
                        try
                        {
                            _MenusOrderChanged.Note = true;
                            PNMenus.PrepareDefaultMenuStrip(d.NoteMenu, MenuType.Note, true);
                        }
                        finally
                        {
                            d.Close();
                        }
                    }
                    break;

                    case MenuType.Edit:
                    {
                        var d = new WndNote();
                        try
                        {
                            _MenusOrderChanged.Edit = true;
                            PNMenus.PrepareDefaultMenuStrip(d.EditMenu, MenuType.Edit, true);
                        }
                        finally
                        {
                            d.Close();
                        }
                    }
                    break;

                    case MenuType.ControlPanel:
                    {
                        var d = new WndCP();
                        try
                        {
                            _MenusOrderChanged.ControlPanel = true;
                            PNMenus.PrepareDefaultMenuStrip(d.CPMenu, MenuType.ControlPanel, true);
                        }
                        finally
                        {
                            d.Close();
                        }
                    }
                    break;
                    }
                }

                _TempHiddenMenus.AddRange(
                    _HiddenLists[type].Item2.Select(s => new PNHiddenMenu(s, type)));

                return(true);
            }
            catch (Exception ex)
            {
                PNStatic.LogException(ex);
                return(false);
            }
        }