Beispiel #1
0
        private async void Button_Renew_Click(object sender, RoutedEventArgs e)
        {
            PowerShellExecution pse = new PowerShellExecution();
            string result           = await pse.ExecuteShellScript(scriptsDirectory + "configEnvironnement.ps1");

            this.checkStatus();
        }
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "getDockerVersion.ps1");

            Console.WriteLine("Version de Docker : " + status);

            Process     currentProc             = Process.GetProcessesByName("com.docker.service")[0];
            long        memoryUsed              = currentProc.PrivateMemorySize64;
            ObjectQuery wql                     = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
            ManagementObjectSearcher   searcher = new ManagementObjectSearcher(wql);
            ManagementObjectCollection results  = searcher.Get();

            foreach (ManagementObject result in results)
            {
                Console.WriteLine("Total Visible Memory: {0} KB", result["TotalVisibleMemorySize"]);
                Console.WriteLine("Free Physical Memory: {0} KB", result["FreePhysicalMemory"]);
                Console.WriteLine("Total Virtual Memory: {0} KB", result["TotalVirtualMemorySize"]);

                Console.WriteLine("Free Virtual Memory: {0} KB", result["FreeVirtualMemory"]);
            }

            Console.WriteLine("Memory used by docker : " + memoryUsed);
            //ProgressBarMemoire.Value = memoryUsed;
        }
Beispiel #3
0
        private async void DialogHost_DialogOpened(object sender, DialogOpenedEventArgs eventArgs)
        {
            PowerShellExecution pse = new PowerShellExecution();
            string result           = await pse.ExecuteShellScript(scriptsDirectory + "test.ps1");

            string message = "";

            if (result.Length > 0)
            {
                message = "Vous disposez d'un proxy, veuillez configurer l'adresse ci-dessous dans les paramètres de Docker";
            }
            else
            {
                message = "Vous ne disposez pas de proxy, veuillez modifier ce paramètre dans Docker, s'il était activé auparavant";
            }
            var person = new Proxy
            {
                Address = result,
                Message = message
            };

            this.dialogProgress.IsOpen = false;

            await this.dialogInfo.ShowDialog(person);
        }
        /* private async void CheckRam()
         * {
         *   PowerShellExecution pse = new PowerShellExecution();
         *   string statusram = await pse.ExecuteShellScript(scriptsDirectory + "CheckRam.ps1");
         *   Console.WriteLine("testram" + statusram.Substring(20));
         *   statusRamDouble = Convert.ToDouble(statusram.Substring(20));
         * }*/
        /*static void Main()
         * {
         *  var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
         *  Console.WriteLine("Physical RAM (bytes): {0}", pc.RawValue);
         * }*/

        private async void Button_Relancer_Click(object sender, RoutedEventArgs e)
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "restartDocker.ps1");

            this.checkStatus();
        }
        private async void stopEcomBox()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string result           = await pse.ExecuteShellScript(scriptsDirectory + "stopApplication.ps1");

            this.checkStatus();
        }
Beispiel #6
0
        private async void stopEcomBox()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string result           = await pse.ExecuteShellScript(scriptsDirectory + "stopDocker.ps1");

            bool isStarted;

            if (result.Contains("Started"))
            {
                isStarted = true;
            }
            else
            {
                isStarted = false;
            }
            this.changeAppStatus(isStarted);
        }
Beispiel #7
0
        private async void startEcomBox()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "lanceURL.ps1");

            bool isStarted;

            if (status.Contains("Started"))
            {
                isStarted = true;
            }
            else
            {
                isStarted = false;
            }
            this.changeAppStatus(isStarted);
        }
Beispiel #8
0
        private async void checkStatus()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "checkEcomboxStatus.ps1");

            Console.WriteLine("test" + status);
            bool isStarted;

            if (status.Contains("Stopped"))
            {
                isStarted = false;
            }
            else
            {
                isStarted = true;
            }
            this.changeAppStatus(isStarted);
        }
        private async void checkStatus()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "checkEcomboxStatus.ps1");

            if (status.Equals("Stopped"))
            {
                this.imgStart.Source  = new BitmapImage(new Uri(imagesDirectory + "power-off.png", UriKind.Relative));
                this.txtStart.Text    = "Démarrer e-comBox";
                this.ecomboxIsStarted = false;
            }
            else
            {
                this.imgStart.Source  = new BitmapImage(new Uri(imagesDirectory + "power.png", UriKind.Relative));
                this.txtStart.Text    = "Stopper e-comBox";
                this.ecomboxIsStarted = true;
            }
            this.pbLoading.Visibility = Visibility.Hidden;
        }
        private async void checkStatus()
        {
            PowerShellExecution pse = new PowerShellExecution();
            string status           = await pse.ExecuteShellScript(scriptsDirectory + "checkEcomboxStatus.ps1");

            Console.WriteLine("test" + status);

            /*if (status.Contains("Stopped"))
             * {
             *
             *  this.imgStartOff.Source = new BitmapImage(new Uri(imagesDirectory + "power-off.png", UriKind.Relative));
             *  this.txtStartOff.Text = "Démarrer docker";
             *  this.ecomboxIsStarted = false;
             * }
             * else
             * {
             *  this.imgStartOff.Source = new BitmapImage(new Uri(imagesDirectory + "power.png", UriKind.Relative));
             *  this.txtStartOff.Text = "Stopper docker";
             *  this.ecomboxIsStarted = true;
             * }*/
            this.pbLoading.Visibility = Visibility.Hidden;
        }