public MenuItemViewModel GetMenuItem(MenuItemType type)
        {
            switch (type)
            {
            case MenuItemType.ShowWindow:
                return(GetViewModel("Menu.ShowWindow", x => _windowsManager.ActivateMainWindow()));

            case MenuItemType.AddDevice:
                return(GetViewModel("Menu.AddDevice", x => throw new NotImplementedException()));

            case MenuItemType.CheckForUpdates:
                return(GetViewModel("Menu.CheckForUpdates", x => throw new NotImplementedException()));

            case MenuItemType.ChangePassword:
                return(GetViewModel("Menu.ChangePassword", x => throw new NotImplementedException()));

            case MenuItemType.UserManual:
                return(GetViewModel("Menu.UserManual", x => OnOpenUrl("Url.UserManual")));

            case MenuItemType.TechnicalSupport:
                return(GetViewModel("Menu.TechnicalSupport", x => Task.Run(() => OnTechSupportAsync("SupportMail"))));

            case MenuItemType.LiveChat:
                return(GetViewModel("Menu.LiveChat", x => OnOpenUrl("Url.LiveChat")));

            case MenuItemType.Legal:
                return(GetViewModel("Menu.Legal", x => OnOpenUrl("Url.Legal")));

            case MenuItemType.RFIDUsage:
                return(GetViewModel("Menu.RFIDUsage", x => OnOpenUrl("Url.RFIDUsage")));

            case MenuItemType.VideoTutorial:
                return(GetViewModel("Menu.VideoTutorial", x => OnOpenUrl("Url.VideoTutorial")));

            case MenuItemType.LogOff:
                return(GetViewModel("Menu.LogOff", x => throw new NotImplementedException()));

            case MenuItemType.Exit:
                return(GetViewModel("Menu.Exit", x => _appHelper.Shutdown()));

            case MenuItemType.Language:
                return(GetLanguages());

            case MenuItemType.LaunchOnStartup:
                return(GetLaunchOnStartup());

            case MenuItemType.GetLogsSubmenu:
                return(GetLogsSubmenu());

            case MenuItemType.Help:
                return(GetViewModel("Menu.Help", x => OnOpenUrl("Url.Help")));

            case MenuItemType.Separator:
                return(null);

            default:
                Debug.Assert(false, $"The type: {type} of menu is not supported.");
                return(null);
            }
        }
Beispiel #2
0
        IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            // Handle messages...
            if (msg == WM_CLOSE)
            {
                // Shutdown application
                _appHelper.Shutdown();
            }

            return(IntPtr.Zero);
        }