Inheritance: Caliburn.Micro.PropertyChangedBase
コード例 #1
0
ファイル: ServicesPlugin.cs プロジェクト: TNOCS/csTouch
 public void Start()
 {
     IsRunning = true;
     config = new MenuItem { Name = "Services" };
     config.Clicked += (e, s) =>
     {
         try {
             svm = new ServicesViewModel {Plugin = this};
             var element = FloatingHelpers.CreateFloatingElement("Services", new Point(600, 400),
                 new Size(800, 600), svm);
             element.CanFullScreen = true;
             AppStateSettings.Instance.FloatingItems.AddFloatingElement(element);
         }
         catch (SystemException ex) {
             Logger.Log("ServicesPlugin", "Cannot start Services plugin", ex.Message, Logger.Level.Error, true);
         }
     };
     AppState.MainMenuItems.Add(config);
 }
コード例 #2
0
ファイル: ShellViewModel.cs プロジェクト: TNOCS/csTouch
        private void AddMainMenuItems()
        {
            // add tools            
            if (AppState.Config.GetBool("App.CanExit", true))
            {
                var canExit = new MenuItem
                {
                    Name = "Exit"
                };
                canExit.Clicked += (e1, s1) =>
                    AppState.CloseApplication();
                AppState.MainMenuItems.Add(canExit);
            }

            // add tools            
            if (AppState.Config.GetBool("App.CanExitAll", false))
            {
                var canExitAll = new MenuItem
                {
                    Name = "Exit All"
                };
                canExitAll.Clicked += (e1, s1) =>
                {
                    foreach (var c in AppState.Imb.Clients.Where(k => k.Value.Capabilities.Contains(csImb.csImb.CapabilityExit)))
                    {
                        AppState.Imb.SendCommand(c.Value.Id, csImb.csImb.CommandExit);
                    }
                    AppState.CloseApplication();
                };

                AppState.MainMenuItems.Add(canExitAll);
            }

            if (AppState.Config.GetBool("App.CanLogoff", false))
            {
                var canLogoff = new MenuItem
                {
                    Name = "Sign Out"
                };
                canLogoff.Clicked += (e1, s1) => AppState.LogOff();
                AppState.MainMenuItems.Add(canLogoff);
            }

            // EV Removed, as it didn't seem to be working, and we already have it in the map plugin.
            //if (AppState.Config.GetBool("App.CanCreateCache", true))
            //{
            //    var canCreateCache = new MenuItem
            //    {
            //        Name = "Create Cache"
            //    };
            //    canCreateCache.Clicked += (e1, s1) => AppState.TriggerCreateCache();
            //    AppState.MainMenuItems.Add(canCreateCache);
            //}

            

            var config = new MenuItem
            {
                Name = "Config \nApp"
            };
            config.Clicked += (e, s) =>
                                  {
                                      OpenConfig();
                                  };
            AppState.MainMenuItems.Add(config);

            AppState.Commands.AddCommand("Config", new[] { "Config" },(c)=> OpenConfig(),new KeyGesture(Key.C,ModifierKeys.Alt));


            var flipScreen = new MenuItem();
            flipScreen.Clicked += delegate { AppState.IsScreenFlipped = !AppState.IsScreenFlipped; };
            flipScreen.Name = "Flip\nScreen";
            flipScreen.Commands = new List<string> { "Flip Screen", "Rotate Screen" };
            AppState.MainMenuItems.Add(flipScreen);


            var procs = Process.GetProcessesByName("AppLauncher");
            if (procs.Any())
            {
                var p = procs.FirstOrDefault();
                var settings = new MenuItem
                {
                    Name = "Back to App Dashboard"
                };
                settings.Clicked += (e, s) =>
                {
                    //SwitchToThisWindow(p.Handle, true);

                    var element = AutomationElement.FromHandle(p.MainWindowHandle);
                    element.SetFocus();
                    //SetForegroundWindow(p.Handle);
                };
                AppState.MainMenuItems.Add(settings);
            }




            //var screenshot = new MenuItem { Name = "Screen-\nshot" };
            //screenshot.Clicked += (e, s) =>
            //                          {

            //                              Capture();
            //                          };
            //AppState.MainMenuItems.Add(screenshot);
        }
コード例 #3
0
ファイル: AboutPlugin.cs プロジェクト: TNOCS/csTouch
 private void CreateMenuItem()
 {
     var about = new MenuItem
     {
         Name = "About &\nLicense",
     };
     about.Clicked += (e, s) =>
     {
         var viewModel = new AboutViewModel {AboutInfo = ReadAboutConfig(), LicenseInfo = ReadLicenseConfig()};
         var element = FloatingHelpers.CreateFloatingElement("About & License", new Point(600, 400), new Size(800, 600), viewModel);
         AppStateSettings.Instance.FloatingItems.AddFloatingElement(element);
     };
     AppState.MainMenuItems.Add(about);
 }
コード例 #4
0
ファイル: MainMenuViewModel.cs プロジェクト: TNOCS/csTouch
 public void Click(MenuItem mi,object b)
 {
     mi.ForceClick();
 }
コード例 #5
0
 public void Start()
 {
     IsRunning = true;
     menuItem = new MenuItem();
     menuItem.Clicked += MenuItemClicked;
     menuItem.Name = "Add Content";
     AppState.MainMenuItems.Add(menuItem);
 }