Skip to content

development

34j edited this page Jun 10, 2022 · 34 revisions

Development

Collecting Licenses

We should make sure that all license text is included in the released app. tomchavakis/nuget-license

  1. Open PowerShell
  2. dotnet tool install --global dotnet-project-licenses
  3. dotnet-project-licenses -i ZoomCloser -u -m
  4. Fill blanks of licenses.md
  5. Copy it when you build the project.

Translating Readme

  1. Edit readme.ja.md since the project author speaks Japanese.

  2. readme.yml will do the following when you git push origin main:

    1. Copy it to readme.md
    2. Use dephraiim/translate-readme to translate readme.md into English, write it down to readme.en.md.
    3. Copy translated readme.en.md to readme.md

ILMerge

  • This project uses ScreenRecorderLib, which has unsafe codes. Therefore, we need to use /zeroPeKind option to merge the library.

    The follwing is what the MSBuild.ILMerge.Task document say, but it doesn't work and throws "Object reference not to set..." error. Google serach

    1. Install MSBuild.ILMerge.Task.
    2. Copy %userprofile%/.nuget/packages/msbuild.ilmerge.task/2.0.0-pre501/content/ILMerge.props to ./ZoomCloser
    3. Replace <ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind> with <ILMergeAllowZeroPeKind>True</ILMergeAllowZeroPeKind>
  • This is not working either.

    1. Add %userprofile%.nuget\packages\ilmerge\3.0.41\tools\net452 to %PATH%
    2. ilmerge ZoomCloser.exe *.dll /zeroPeKind /out:Merged.exe
    3. Could not load assembly from the location '...ZoomCloser.exe'

Binding

UI

Using MahApps.Metro and MetroRadiance.Fork. First adopt Mahapps.Metro ResourceDictionary then adopt MetroRadiance.Fork ResourceDictionary, so that for MahApps' original controls their ResourceDictionary will be adopted and for common controls MetroRadiance.Fork's.

NotifyIcon

Using Hardcodet.NotifyIcon.Wpf.

Dependency Injection

Simple→ →Sophisticated
Poor Man's DI Convention over Configuration Valuable
 
Explicit Register
Pointless

Using Unity.RegistrationByConvention to integrate "Convention over Configuration" DI. We want to do this:

App.xaml.cs

private void OnApplicationStartUp(object sender, StartupEventArgs e)
{
    container = new UnityContainer();
    container.RegisterTypes(AllClasses.FromLoadedAssemblies(), WithMappings.FromMatchingInterface, WithName.Default)
}

But we are using Prism.Wpf and IContainerRegistry does not have RegisterTypes() method. Therefore, we do like this.

App.xaml.cs

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
    foreach (var type in AllClasses.FromLoadedAssemblies())
    {
        foreach (Type interFace in WithMappings.FromAllInterfaces(type))
        {
            containerRegistry.Register(interFace, type, WithName.Default(type));
        }
        containerRegistry.Register(type);
    }
}

Muting Window

Using CoreAudio.

Localization

Gu.Wpf.Localization. Updating Translator.Cultures to refresh LanguageSelector at CultureUtils.InitTranslator. Using salarcode/AutoResxTranslator to translate resx files.

Handling Zoom meetings window

Vanara.PInvoke.User32 for focusing window and so on, and System.Windows.Automation for getting window info.

How to get the number of participants from Zoom Meetings window

inspect.exe can be used to figure out the structure of the Zoom Meetings app.

  1. When the window is minimized

    No way to get it.

  2. When the window is normal or maximized

    1. Using System.Windows.Automation (UI Automation)

      1. "30" "" ウィンドウ "表示中、参加者パネルを閉じる、30参加者, Alt+U" ボタン "" ウィンドウ "ミーティング ツール" ウィンドウ "ContentLeftPanel" ウィンドウ "Zoom ミーティング" ウィンドウ "デスクトップ 1" ウィンドウ [ No Parent ]

      2. "表示中、参加者パネルを閉じる、30参加者, Alt+U" ボタン "" ウィンドウ "ミーティング ツール" ウィンドウ "ContentLeftPanel" ウィンドウ "Zoom ミーティング" ウィンドウ "デスクトップ 1" ウィンドウ [ No Parent ]

      Below are ONLY available when participants panel is opened.

      1. "参加者 (30)" "PListContainer" ウィンドウ "ContentRightPanel" ウィンドウ "Zoom ミーティング" ウィンドウ "デスクトップ 1" ウィンドウ [ No Parent ]

      2. "参加者 (30), 展開されています" "" ウィンドウ "" ウィンドウ "PListContainer" ウィンドウ "ContentRightPanel" ウィンドウ "Zoom ミーティング" ウィンドウ "デスクトップ 1" ウィンドウ [ No Parent ]

    2. using user32.dll

      Below are ONLY available when participants panel is opened.

      1. "参加者 (30)" "PListContainer" ウィンドウ "ContentRightPanel" ウィンドウ "Zoom ミーティング" ウィンドウ "デスクトップ 1" ウィンドウ [ No Parent ]