コード例 #1
0
ファイル: ControlPanel.cs プロジェクト: zhuxb711/Vanara
 /// <summary>Opens the specified Control Panel item.</summary>
 /// <param name="item">The Control Panel item.</param>
 /// <param name="page">Optional. The Control Panel page.</param>
 /// <returns>
 /// <see langword="true"/> if this item is supported and has been opened. <see langword="false"/> if an error prevented opening or
 /// the item or page was unsupported on this OS.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">page</exception>
 public static bool Open(ControlPanelItem item, string page = null)
 {
     if (page != null && Array.IndexOf(item.ValidPages(), page) == -1)
     {
         throw new ArgumentOutOfRangeException(nameof(page));
     }
     return(CP.Open(item.CanonicalName(), page));
 }
コード例 #2
0
ファイル: ControlPanelService.cs プロジェクト: aozora/arashi
 public void SaveControlPanelItem(ControlPanelItem controlPanelItem)
 {
     //using (NHTransactionScope tx = new NHTransactionScope())
      //{
      Repository<ControlPanelItem>.Save(controlPanelItem);
      //   tx.VoteCommit();
      //}
 }
コード例 #3
0
 /// <summary>Opens the specified Control Panel item.</summary>
 /// <param name="item">The Control Panel item.</param>
 /// <param name="page">Optional. The Control Panel page.</param>
 /// <exception cref="ArgumentOutOfRangeException">page</exception>
 public static void Open(ControlPanelItem item, string page = null)
 {
     if (page != null && Array.IndexOf(item.ValidPages(), page) == -1)
     {
         throw new ArgumentOutOfRangeException(nameof(page));
     }
     // TODO: handle minOsVer gracefully
     CP.Open(item.CanonicalName(), page, null);
 }
コード例 #4
0
ファイル: ControlPanelService.cs プロジェクト: aozora/arashi
        public void DeleteControlPanelItem(ControlPanelItem controlPanelItem)
        {
            //using (NHTransactionScope tx = new NHTransactionScope())
             //{

            Repository<ControlPanelItem>.Delete(controlPanelItem);

            //foreach (ControlPanelItemRole controlPanelItemRole in controlPanelItem.ControlPanelItemRoles)
            //   DeleteControlPanelItemRole(controlPanelItemRole);

            //controlPanelItem.ControlPanelItemRoles.Clear();
             //   tx.VoteCommit();
             //}
        }
コード例 #5
0
 private static CPAssociateAttribute GetAttr(ControlPanelItem value) => typeof(ControlPanelItem).GetField(value.ToString())?.GetCustomAttributes <CPAssociateAttribute>().FirstOrDefault();
コード例 #6
0
 /// <summary>Gets the list of valid pages for a Control Panel item.</summary>
 /// <param name="cp">The <see cref="ControlPanelItem"/> value.</param>
 /// <returns>The list of valid pages.</returns>
 /// <exception cref="InvalidOperationException">No information exists for the <see cref="ControlPanelItem"/> value.</exception>
 public static string[] ValidPages(this ControlPanelItem cp) => GetAttr(cp)?.ValidPages ?? throw new InvalidOperationException();
コード例 #7
0
 /// <summary>Gets the module name for a Control Panel item.</summary>
 /// <param name="cp">The <see cref="ControlPanelItem"/> value.</param>
 /// <returns>The module name.</returns>
 /// <exception cref="InvalidOperationException">No information exists for the <see cref="ControlPanelItem"/> value.</exception>
 public static string ModuleName(this ControlPanelItem cp) => GetAttr(cp)?.ModuleName ?? throw new InvalidOperationException();
コード例 #8
0
 /// <summary>Gets the minimum Windows client for a Control Panel item.</summary>
 /// <param name="cp">The <see cref="ControlPanelItem"/> value.</param>
 /// <returns>The minimum Windows client.</returns>
 /// <exception cref="InvalidOperationException">No information exists for the <see cref="ControlPanelItem"/> value.</exception>
 public static PInvoke.PInvokeClient MinClient(this ControlPanelItem cp) => GetAttr(cp)?.MinClient ?? throw new InvalidOperationException();
コード例 #9
0
 /// <summary>Gets the GUID for a Control Panel item.</summary>
 /// <param name="cp">The <see cref="ControlPanelItem"/> value.</param>
 /// <returns>The GUID.</returns>
 /// <exception cref="InvalidOperationException">No information exists for the <see cref="ControlPanelItem"/> value.</exception>
 public static Guid Guid(this ControlPanelItem cp) => GetAttr(cp)?.Guid ?? throw new InvalidOperationException();
コード例 #10
0
 /// <summary>Gets the canonical name for a Control Panel item.</summary>
 /// <param name="cp">The <see cref="ControlPanelItem"/> value.</param>
 /// <returns>The canonical name.</returns>
 /// <exception cref="InvalidOperationException">No information exists for the <see cref="ControlPanelItem"/> value.</exception>
 public static string CanonicalName(this ControlPanelItem cp) => GetAttr(cp)?.CanonicalName ?? throw new InvalidOperationException();
コード例 #11
0
ファイル: ControlPanel.cs プロジェクト: zhuxb711/Vanara
 /// <summary>Gets the path of a Control Panel item.</summary>
 /// <param name="item">The Control Panel item.</param>
 /// <returns>The path.</returns>
 public static string GetPath(ControlPanelItem item) => CP.GetPath(item.CanonicalName());