Example #1
0
            /// <summary>
            /// Make a smooth transition between two windows using Lerp.
            /// </summary>
            /// <param name="WFade">Window to fade.</param>
            /// <param name="WShow">Window to reveal.</param>
            /// <param name="Delay">Delay in ms.</param>
            /// <param name="shouldClose ">Close if true, Hide if false.</param>
            public static void Switch(System.Windows.Window WFade, System.Windows.Window WShow, int Delay = 1, bool shouldClose = true)
            {
                __shouldClose = shouldClose;

                SWITCH_LerpFade = new Core.Lerp(1, 0, 0.01f, 0.05f, 1);
                SWITCH_LerpShow = new Core.Lerp(0, 1, 0.01f, 0.05f, 1);

                SWITCH_LerpFade.delay = Delay;
                SWITCH_LerpShow.delay = Delay;

                _WFade = WFade;
                _WShow = WShow;

                _WShow.Hide();
                _WFade.Show();


                SWITCH_LerpShow.LStart += LerpShow_LerpStart;
                SWITCH_LerpShow.LTick  += LerpShow_LerpTick;
                SWITCH_LerpShow.LDone  += LerpShow_LerpDone;

                SWITCH_LerpFade.LStart += LerpFade_LerpStart;
                SWITCH_LerpFade.LTick  += LerpFade_LerpTick;
                SWITCH_LerpFade.LDone  += LerpFade_LerpDone;

                SWITCH_LerpFade.Start();
                SWITCH_LerpShow.Start();
            }
Example #2
0
        public ViewManager(BackgroundService backgroundService)
        {
            _backgroundService             = backgroundService;
            _backgroundService.LogChanged += _backgroundService_LogChanged;

            _components = new System.ComponentModel.Container();

            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = Properties.Resources.QuizBuzzIcon,
                Text             = _backgroundService.BuzzerManager.Buzzers.Count * 4 + " buzzers connected",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += NotifyIcon_MouseUp;

            _statusViewModel = new ViewModel.StatusViewModel
            {
                Icon = AppIcon
            };

            _hiddenWindow         = new System.Windows.Window();
            _hiddenWindow.Closed += _hiddenWindow_Closed;
            _hiddenWindow.Hide();
        }
Example #3
0
        public ViewManager(RegClientInfor clientInfor)
        {
            _clientInfor = clientInfor;
            _components  = new System.ComponentModel.Container();
            _notifyIcon  = new System.Windows.Forms.NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = FileTracking.Client.Application.Properties.Resources.NotReadyIcon,
                Text             = "File Tracking",
                Visible          = true,
            };


            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += notifyIcon_MouseUp;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();

            _frmLog             = new frmLogging();
            _frmLog.LoggingText = "";

            InitConnect();
            checkWebSocketTimer          = new System.Timers.Timer();
            checkWebSocketTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            checkWebSocketTimer.Interval = 60000;
            checkWebSocketTimer.Enabled  = true;
        }
Example #4
0
        public ViewManager(IServiceManager serviceManager)
        {
            Debug.Assert(serviceManager != null);

            this.serviceManager = serviceManager;

            components = new Container();
            notifyIcon = new NotifyIcon(components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = serviceManager.Status == ServiceControllerStatus.Running ? Resources.shutter32x32BlueIcon : Resources.shutter32x32___GrayIcon,
                Text             = serviceManager.Status.ToString(),
                Visible          = true
            };

            notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            notifyIcon.MouseUp     += NotifyIcon_MouseUp;

            aboutViewModel  = new AboutViewModel();
            statusViewModel = new StatusViewModel {
                Icon = AppIcon
            };
            aboutViewModel.Icon = statusViewModel.Icon;

            hiddenWindow = new System.Windows.Window();
            hiddenWindow.Hide();
        }
Example #5
0
        public ViewManager()
        {
            leftIsPrimary = !System.Windows.Forms.SystemInformation.MouseButtonsSwapped;
            System.Drawing.Icon ic = leftIsPrimary ?
                                     SystemTrayApp.Properties.Resources.LeftMouseButtonActive :
                                     SystemTrayApp.Properties.Resources.RightMouseButtonActive;


            _components = new System.ComponentModel.Container();
            _notifyIcon = new System.Windows.Forms.NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = ic,
                Text             = "Mouser Switcher - swap your left and right mouse buttons",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += notifyIcon_MouseUp;

            _aboutViewModel = new WpfFormLibrary.ViewModel.AboutViewModel();
            //_statusViewModel = new WpfFormLibrary.ViewModel.StatusViewModel();

            //_statusViewModel.Icon = AppIcon;
            _aboutViewModel.Icon = AppIcon;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();
        }
        private ContextMenuStrip tworzMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem ukryjToolStripMenuItem = new ToolStripMenuItem("Ukryj");

            ukryjToolStripMenuItem.Click += (s, e) => { okno.Hide(); };
            menu.Items.Add(ukryjToolStripMenuItem);

            ToolStripMenuItem przywrocToolStripMenuItem = new ToolStripMenuItem("Przywróć");

            przywrocToolStripMenuItem.Click += (s, e) => { okno.Show(); };
            menu.Items.Add(przywrocToolStripMenuItem);

            ToolStripMenuItem zamknijToolStripMenuItem = new ToolStripMenuItem("Zamknij");

            zamknijToolStripMenuItem.Click += (s, e) => { okno.Close(); };
            menu.Items.Add(zamknijToolStripMenuItem);

            menu.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem oAutorzeToolStripMenuItem = new ToolStripMenuItem("O...");

            oAutorzeToolStripMenuItem.Click += (s, e) =>
            {
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("SplashScreen.png");
                splashScreen.Show(false, true);
                System.Threading.Thread.Sleep(1000);
                splashScreen.Close(new TimeSpan(0, 0, 1));
            };
            menu.Items.Add(oAutorzeToolStripMenuItem);

            return(menu);
        }
Example #7
0
            /// <summary>
            /// Make a smooth transition between two windows using Smooth Step.
            /// </summary>
            /// <param name="WFade">Window to fade.</param>
            /// <param name="WShow">Window to reveal.</param>
            /// <param name="Delay">Delay in ms.</param>
            /// <param name="shouldHideAfterSwitch">Close if true, Hide if false.</param>
            public static void Switch(System.Windows.Window WFade, System.Windows.Window WShow, int Delay = 1, bool shouldClose = true)
            {
                __shouldClose = shouldClose;

                SWITCH_StepFade = new Core.SmoothStep(0, 1, 1.00f, -0.001f, 0.01f, 1);
                SWITCH_StepShow = new Core.SmoothStep(0, 1, 0.00f, +0.001f, 0.01f, 1);


                SWITCH_StepFade.delay = Delay;
                SWITCH_StepShow.delay = Delay;

                _WFade = WFade;
                _WShow = WShow;

                _WFade.Show();
                _WShow.Hide();

                SWITCH_StepShow.SmoothStepStart += SWITCH_StepShow_SmoothStepStart;;
                SWITCH_StepShow.SmoothStepTick  += SWITCH_StepShow_SmoothStepTick;;
                SWITCH_StepShow.SmoothStepDone  += SWITCH_StepShow_SmoothStepDone;;

                SWITCH_StepFade.SmoothStepStart += SWITCH_StepFade_SmoothStepStart;;
                SWITCH_StepFade.SmoothStepTick  += SWITCH_StepFade_SmoothStepTick;;
                SWITCH_StepFade.SmoothStepDone  += SWITCH_StepFade_SmoothStepDone;;

                SWITCH_StepFade.Start();
                SWITCH_StepShow.Start();
            }
Example #8
0
        public ViewManager(DeviceManager deviceManager)
        {
            System.Diagnostics.Debug.Assert(deviceManager != null);

            _deviceManager = deviceManager;

            _components = new System.ComponentModel.Container();
            _notifyIcon = new System.Windows.Forms.NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = DbaLogger.Properties.Resources.NotReadyIcon,
                Text             = "System Tray App: Device Not Present",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += notifyIcon_MouseUp;

            _aboutViewModel  = new WpfFormLibrary.ViewModel.AboutViewModel();
            _statusViewModel = new WpfFormLibrary.ViewModel.StatusViewModel();

            _statusViewModel.Icon = AppIcon;
            _aboutViewModel.Icon  = _statusViewModel.Icon;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();
        }
Example #9
0
        private ContextMenuStrip createMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem hideToolStripMenuItem = new ToolStripMenuItem("Ukryj");

            hideToolStripMenuItem.Click += (s, e) => { window.Hide(); };
            menu.Items.Add(hideToolStripMenuItem);

            ToolStripMenuItem restoreToolStripMenuItem = new ToolStripMenuItem("Przywróć");

            restoreToolStripMenuItem.Click += (s, e) => { window.Show(); };
            menu.Items.Add(restoreToolStripMenuItem);

            ToolStripMenuItem closeToolStripMenuItem = new ToolStripMenuItem("Zamknij");

            closeToolStripMenuItem.Click += (s, e) => { window.Close(); };
            menu.Items.Add(closeToolStripMenuItem);

            menu.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem aboutTheAutorToolStripMenuItem = new ToolStripMenuItem("O...");

            aboutTheAutorToolStripMenuItem.Click += (s, e) =>
            {
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("SplashScreen.png");
                splashScreen.Show(false, true);
                System.Threading.Thread.Sleep(1000);
                splashScreen.Close(new TimeSpan(0, 0, 1));
            };
            menu.Items.Add(aboutTheAutorToolStripMenuItem);
            return(menu);
        }
Example #10
0
        // This allows code to be run on a GUI thread

        public TrayHelper(Microsoft.AspNetCore.Hosting.IWebHost _webHost)
        {
            this._webHost = _webHost;
            _webHost.Start();

            System.Drawing.Icon trayStoppedIcon;
            using (var iconStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DeskCommandCore.Resources.trayRunning.ico"))
            {
                trayStoppedIcon = new System.Drawing.Icon(iconStream);
            }

            _components = new System.ComponentModel.Container();
            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = trayStoppedIcon,
                Text             = Resources.TrayHelper_TrayHelper_Desk_Command,
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.MouseUp += notifyIcon_MouseUp;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();



            ShowRunningMessage();
        }
Example #11
0
 private static void LerpFade_LerpDone(object sender, LerpArgs e)
 {
     if (__shouldClose)
     {
         _WFade.Close();
     }
     else
     {
         _WFade.Opacity = 1; _WFade.Hide();
     }
 }
Example #12
0
 private static void SINGLE_LerpFade_LerpDone(object sender, LerpArgs e)
 {
     HWND.Opacity = 0;
     if (_shouldClose)
     {
         HWND.Close();
     }
     else
     {
         HWND.Hide(); HWND.Opacity = 1;
     }
 }
Example #13
0
 private static void SWITCH_StepFade_SmoothStepDone(object sender, Arguments.SmoothStepArgs e)
 {
     _WFade.Opacity = 0;
     if (__shouldClose)
     {
         _WFade.Close();
     }
     else
     {
         _WFade.Hide(); _WFade.Opacity = 1;
     }
 }
Example #14
0
 private static void SINGLE_StepFade_SmoothStepDone(object sender, SmoothStepArgs e)
 {
     HWND.Opacity = 0;
     if (_shouldClose)
     {
         HWND.Close();
     }
     else
     {
         HWND.Hide(); HWND.Opacity = 1;
     }
 }
Example #15
0
 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Window window = ((System.Windows.Controls.Button)sender).TemplatedParent as System.Windows.Window;
     if (window is MainWindow)
     {
         window.WindowState = System.Windows.WindowState.Minimized;
     }
     else
     {
         window.Hide();
     }
 }
Example #16
0
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            System.Windows.Window window = ((System.Windows.Controls.Button)sender).TemplatedParent as System.Windows.Window;

            if (window is MainWindow)
            {
                if (((WTalk.Desktop.ViewModel.MainViewModel)window.DataContext).AuthenticationRequired)
                {
                    App.Current.Shutdown();
                }
                else
                {
                    window.WindowState = System.Windows.WindowState.Minimized;
                }
            }
            else
            {
                window.Hide();
            }
        }
Example #17
0
        public MenuViewController(IDeviceController deviceController)
        {
            System.Diagnostics.Debug.Assert(deviceController != null);

            _deviceController = deviceController;
            _deviceController.OnStateChanged += OnStateChanged;

            _components = new System.ComponentModel.Container();
            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = Properties.Resources.NotReadyIcon,
                Text             = "Overlay is not found",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();
        }
        public ViewManager(HttpAsyncHost server)
        {
            _server = server;

            _server.StatusChanged += this.OnStatusChange;

            _components = new Container();
            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = Icons.AppPausedIcon,
                Text             = "CasterUIAutomation: Starting Up...",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += notifyIcon_MouseUp;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();

            StartServer();
        }
Example #19
0
        //private ToolStripMenuItem _startDeviceMenuItem;

        //private ToolStripMenuItem _stopDeviceMenuItem;

        public ViewManager()
        {
            _components = new System.ComponentModel.Container();
            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = Properties.Resources.AppIcon,
                Text             = "Folder Observer Tray App",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += NotifyIconDoubleClick;
            _notifyIcon.MouseUp     += NotifyIconMouseUp;

            _aboutViewModel = new AboutViewModel();
            _mainViewVm     = new MainViewVm();

            _mainViewVm.Icon     = AppIcon;
            _aboutViewModel.Icon = _mainViewVm.Icon;

            _hiddenWindow = new System.Windows.Window();
            _hiddenWindow.Hide();
        }
Example #20
0
 public override void Hide()
 {
     window.Hide();
 }
Example #21
0
File: Ac.cs Project: 15831944/Geo7
 public EditorUserInteractionWrapper(System.Windows.Window wnd)
 {
     window         = wnd;
     window.Topmost = true;
     window.Hide();
 }
 private void CloseDialog(System.Windows.Window dialog)
 {
     _activeDialog.Hide();
     _activeDialog = null;
 }
Example #23
0
        //public class JoPaths
        //{
        //    public string getpath { get; set; }
        //}

        public async void handle(Object myClientSocket)
        {
            Socket ClientSocket = null;

            try
            {
                ClientSocket = (Socket)myClientSocket;
                Projection    projection = new Projection();
                WindowControl wc         = new WindowControl();
                Applacation   app        = new Applacation();
                MediaFunction media      = new MediaFunction();
                Game          game       = new Game();
                Response      response   = null;

                //test = windows.BackGroundWindow.Instance();
                Console.WriteLine("name is:{0}", name);
                log.Info(string.Format("接收到手机发来的指令 name = {0},command = {1},param = {2}", name, command, param));
                switch (name)
                {
                case CommandName.PC:
                    if (command.Equals("AddDirsHTTP"))
                    {
                        string status = null;
                        bool   flag   = true;
                        Console.WriteLine("paths is:{0}", param["paths"]);
                        String[] pathlist = param["paths"].Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries);

                        //List<JoPaths> pathlist = JsonConvert.DeserializeObject<List<JoPaths>>(param["paths"]);
                        //List<JoPaths> err_pathlist = new List<JoPaths>();
                        //String[] err_pathlist = null;
                        List <string> err_pathlist = new List <string>();
                        foreach (string path in pathlist)
                        {
                            Console.WriteLine("path is:{0}" + path);
                            string dirPath = path;
                            if (File.Exists(dirPath) || Directory.Exists(dirPath))
                            {
                                if (Directory.Exists(dirPath))
                                {
                                    DirectoryInfo Folder = new DirectoryInfo(dirPath);
                                    foreach (FileInfo file in Folder.GetFiles())
                                    {
                                        if (File.Exists(file.FullName))
                                        {
                                            Console.WriteLine("file fullname_1 is:{0}", file.FullName);
                                            Node node = new Node(file.FullName);
                                            NodeContainer.addNode(node);
                                        }
                                    }
                                }
                                else
                                {
                                    FileInfo file = new FileInfo(dirPath);
                                    Console.WriteLine("file fullname_2 is:{0}", file.FullName);
                                    Node node = new Node(file.FullName);
                                    NodeContainer.addNode(node);
                                }
                                Console.WriteLine("status:200");
                            }
                            else
                            {
                                flag = false;
                                err_pathlist.Add(path);
                                Console.WriteLine("status:404");
                            }
                        }
                        if (flag)
                        {
                            status = "200";
                        }
                        else
                        {
                            status = "404";
                        }
                        //string errpaths = "{\"errorPaths:\"" + "\"" + err_pathlist +"\"}";
                        response = new Response(status, "", CommandName.PC, err_pathlist);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("close"))
                    {
                        Environment.Exit(0);
                    }
                    else if (command.Equals("SEARCH"))
                    {
                        string key = param["key"];
                        List <MediaMengMeng> allmedia = util.config.MediaConfig.SearchAll(key);
                        response = new Response("200", "", CommandName.PC, JsonConvert.SerializeObject(allmedia));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.VIDEO:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        media.AddRecentMeiaList(new MediaItem(param["path"]));
                        response = new Response("200", "", CommandName.VIDEO, null);    //////////////////////////////////////
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.VIDEO, JsonConvert.SerializeObject(media.getMediasByPath("VIDEO", param["folder"])));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETRECENTLIST"))
                    {
                        response = new Response("200", "", CommandName.VIDEO, JsonConvert.SerializeObject(media.GetRecentVideoList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserVideoConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.VIDEO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.VIDEO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }

                    break;

                case CommandName.AUDIO:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        media.AddRecentMeiaList(new MediaItem(param["path"]));
                        response = new Response("200", "", CommandName.AUDIO, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.getMediasByPath("AUDIO", param["folder"])));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETRECENTLIST"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.GetRecentAudioList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSETS"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.GetAudioSet()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDSET"))
                    {
                        if (media.AddAudioSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDFILESTOSET"))
                    {
                        string s = param["liststr"];
                        if (media.AddAudioSet(param["setname"], JsonConvert.DeserializeObject <List <MediaMengMeng> >(s)))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETESET"))
                    {
                        if (media.DeleteAudiSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSET"))
                    {
                        bool re;
                        //if (!param.ContainsKey("asBGM"))
                        //{
                        //    re = PlayMedias(param["tvname"], "audio", param["setname"]);
                        //}
                        //else
                        //{
                        re = PlayMedias(param["tvname"], "audio", param["setname"]);
                        //}
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetAudioSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentAudioList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentAudioList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSETASBGM"))
                    {
                        bool re;
                        re = PlayMedias(param["tvname"], "audio", param["setname"], null);
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetAudioSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentAudioList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentAudioList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserAudioConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.IMAGE:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        response = new Response("200", "", CommandName.IMAGE, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYALL"))
                    {
                        List <MediaMengMeng> l    = media.getMediasByPath("IMAGE", param["folder"]);
                        List <string>        urls = new List <string>();

                        foreach (MediaMengMeng m in l)
                        {
                            info.media.MediaItem mi = new info.media.MediaItem(m.pathName);
                            urls.Add(mi.url);
                        }
                        foreach (info.tv.TVInfo item in MyInfo.tvLibrary.value)
                        {
                            if (item.name.Equals(param["tvname"]))
                            {
                                function.tv.TVFunction.sendCommand(item.ip, info.tv.TVCommand.GetInstance("OPEN_HTTP_MEDIA", null, false, "", "image", urls, null));
                            }
                        }
                        //foreach (var ls in list)
                        //{
                        //    PlayMedia(param["tvname"], ls[""]);
                        //}


                        response = new Response("200", "", CommandName.IMAGE, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        List <MediaMengMeng> list = media.getMediasByPath("IMAGE", param["folder"]);
                        response = new Response("200", "", CommandName.IMAGE, JsonConvert.SerializeObject(list));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSETS"))
                    {
                        response = new Response("200", "", CommandName.IMAGE, JsonConvert.SerializeObject(media.GetImageSet()));

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDSET"))
                    {
                        if (media.AddImageSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDFILESTOSET"))
                    {
                        string s = param["liststr"];
                        if (media.AddImageSet(param["setname"], JsonConvert.DeserializeObject <List <MediaMengMeng> >(s)))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETESET"))
                    {
                        if (media.DeleteImageSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSET"))
                    {
                        bool re = PlayMedias(param["tvname"], "image", param["setname"]);
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetImageSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentImageList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentImageList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserImageConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.VIDEO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.VIDEO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.APP:
                    if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.APP, JsonConvert.SerializeObject(app.GetAppList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("OPEN_RDP"))
                    {
                        if ((string)param["path"] == "back")
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                System.Windows.Window test = windows.BackGroundWindow.Instance();
                                test.Hide();
                            }));
                            app.CloseAll();
                            Type   oleType   = Type.GetTypeFromProgID("Shell.Application");
                            object oleObject = System.Activator.CreateInstance(oleType);
                            oleType.InvokeMember("ToggleDesktop", BindingFlags.InvokeMethod, null, oleObject, null);
                        }
                        else
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                System.Windows.Window test = windows.BackGroundWindow.Instance();
                                test.Show();
                            }));
                            app.OpenApp((string)param["path"], "");
                        }
                    }
                    else if (command.Equals("OPEN_MIRACAST"))
                    {
                        //WindowControl.SetTaskBarState(0);
                        if (!projection.IsConnection())
                        {
                            app.CloseAll();
                            //projection.EnterQS();
                            //projection.ClosePopup();
                        }
                        Process pro;
                        pro = app.OpenApp((string)param["path"], "");
                        //Console.WriteLine(System.Windows.Forms.Screen.AllScreens.Last());
                        DeviceItem item = util.config.UserScreenConfig.GetScreen(param["tvname"]);
                        if (item != null)
                        {
                            await projection.SelectProjectionDevice(item.screen);

                            wc.MoveWindow(pro, System.Windows.Forms.Screen.AllScreens.Last(), true);
                            response = new Response("200", "", CommandName.APP, null);
                        }
                        else
                        {
                            response = new Response("404", "don't have set miracast", CommandName.APP, null);
                        }
                        //projection.ClearMiracastPopup();

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.GAME:
                    if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.GAME, JsonConvert.SerializeObject(game.GetGameList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("OPEN"))
                    {
                        game.OpenGame(param["path"], "");
                        response = new Response("200", "", CommandName.GAME, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.SYS:
                    if (command.Equals("GETINFOR"))
                    {
                        response = new Response("200", "", CommandName.SYS, JsonConvert.SerializeObject(function.pcapp.PCInformation.GetInstance()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSCREENSTATE"))
                    {
                        if (MyInfo.IsSreenLock)
                        {
                            response = new Response("404", "", CommandName.SYS, null);
                        }
                        else
                        {
                            response = new Response("200", "", CommandName.SYS, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.SECURITY:
                    if (command.Equals("PAIR"))
                    {
                        string code = param["code"];
                        if (code.Equals(PairCodeConfig.GetPairCode()))
                        {
                            response = new Response("200", "", CommandName.SECURITY, "true");
                        }
                        else
                        {
                            response = new Response("200", "", CommandName.SECURITY, "false");
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;
                }
                log.InfoFormat("Command 接受到的命令:  {0},返回的结果:  {1}", JsonConvert.SerializeObject(this), JsonConvert.SerializeObject(response));
                ClientSocket.Close();
            }
            catch (Exception e)
            {
                if (ClientSocket != null)
                {
                    ClientSocket.Close();
                }
                log.Error("Comand 执行出错", e);
            }
        }