Esempio n. 1
0
        private async void Export_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var            Data            = Dgv_Home.ItemsSource.Cast <BagiShuDto>().ToList();
                SaveFileDialog _saveFileDialog = new SaveFileDialog();
                _saveFileDialog.Filter = "Excel file (*.xls)|*.xlsx";
                if (_saveFileDialog.ShowDialog() == true)
                {
                    Dialog_Loading = new Loading();
                    Dialog_Loading.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    Dialog_Loading.Show();

                    await Task.Run(() => CreateXls(Data, _saveFileDialog.FileName));

                    Dialog_Loading.Close();
                    Dgv_Home.ItemsSource = _data;
                }
            }
            catch (Exception ex)
            {
                Dialog_Loading.Dispatcher.BeginInvoke(new Action(() => { Dialog_Loading.Close(); }));
                LogError.WriteError(ex);
                System.Windows.MessageBox.Show("Error!! \n telah terjadi kesalahan, Hubungi administrator", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        private async Task CarregarCartas()
        {
            await Task.Run(() =>
            {
                CartaUtil cartaUtil = new CartaUtil();
                cartas = cartaUtil.GetCartas(this.tema, this.qtdeCartas, this.off);
                if (cartas != null && cartas.Count == this.qtdeCartas)
                {
                    controler = new ControlerGame(cartas);
                    for (var x = 0; x < cartas.Count; x++)
                    {
                        PictureBox picture = (PictureBox)this.Controls.Find("pictureBox_" + (x + 1), false)[0];
                        Button button      = (Button)this.Controls.Find("button_" + (x + 1), false)[0];
                        picture.Image      = cartas[x].Imagem;
                        picture.Tag        = cartas[x].Id;
                        picture.Refresh();
                        picture.SizeMode = PictureBoxSizeMode.StretchImage;

                        button.Tag = cartas[x].Id;
                    }

                    if (loadingScreen.InvokeRequired)
                    {
                        loadingScreen.Invoke((MethodInvoker) delegate
                        {
                            loadingScreen.Close();
                            this.Show();
                        });
                    }
                    else
                    {
                        loadingScreen.Close();
                        this.Show();
                    }
                }
                else
                {
                    if (loadingScreen.InvokeRequired)
                    {
                        loadingScreen.Invoke((MethodInvoker) delegate
                        {
                            loadingScreen.Close();
                            ErroDownload erro = new ErroDownload();
                            erro.Show();
                        });
                    }
                    else
                    {
                        loadingScreen.Close();
                        ErroDownload erro = new ErroDownload();
                        erro.Show();
                    }
                }
            });
        }
Esempio n. 3
0
 /// <summary>
 /// Loading timer tick, po 3 vterinach vypne loading okno
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void loadingTimer_Tick(object sender, EventArgs e)
 {
     // vypni loading window pouze pokud uz je hlavni okno nacteno,
     // v kazdem pripade vypni loading timer
     if (this.IsLoaded)
     {
         loadingWindow.Close();
     }
     IsEnabled = true;
     loadingTimer.Stop();
 }
Esempio n. 4
0
        private async void Export_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var            Data            = _dataAnggotaServices.GetAll();
                SaveFileDialog _saveFileDialog = new SaveFileDialog();
                _saveFileDialog.Filter = "Excel file (*.xls)|*.xlsx";
                if (_saveFileDialog.ShowDialog() == true)
                {
                    Dialog_Loading = new Loading();
                    Dialog_Loading.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    Dialog_Loading.Show();

                    await Task.Run(() => CreateXls(Data, _saveFileDialog.FileName));

                    System.Windows.MessageBox.Show("Data berhasil di export", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
                    Dialog_Loading.Close();
                }
            }
            catch (Exception ex)
            {
                Dialog_Loading.Dispatcher.BeginInvoke(new Action(() => { Dialog_Loading.Close(); }));
                LogError.WriteError(ex);
                System.Windows.MessageBox.Show("Error!! \n telah terjadi kesalahan, Hubungi administrator", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        private async void HitungShu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                BtnSimpan.IsEnabled = false;
                Export.IsEnabled    = false;

                if (!string.IsNullOrEmpty(Tahun.Text))
                {
                    int intTahun = Convert.ToInt32(Tahun.Text);

                    _intTahun = intTahun;

                    Dialog_Loading = new Loading();
                    Dialog_Loading.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    Dialog_Loading.Show();

                    var Data = await Task.Run(() => _bagiShuServices.HitungAllShu(_intTahun));

                    _data = CollectionViewSource.GetDefaultView(Data);

                    Dialog_Loading.Close();
                    Dgv_Home.ItemsSource = _data;

                    BtnSimpan.IsEnabled = true;
                    Export.IsEnabled    = true;
                }
            }
            catch (Exception ex)
            {
                LogError.WriteError(ex);
                System.Windows.MessageBox.Show("Error!! \n telah terjadi kesalahan, Hubungi administrator", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 6
0
        private void but_getfw_Click(object sender, EventArgs e)
        {
            var basedir = Settings.GetDataDirectory() + "History";

            Directory.CreateDirectory(basedir);

            var fw = new Firmware();

            var list = fw.getFWList();

            var options = new optionsObject();

            options.softwares = list;

            var members = typeof(software).GetFields();

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.IndentChars = "    ";
            settings.Indent      = true;
            settings.Encoding    = Encoding.ASCII;

            using (var xmlwriter = XmlWriter.Create(basedir + Path.DirectorySeparatorChar + @"firmware2.xml", settings))
            {
                for (int a = 0; a < options.softwares.Count; a++)
                {
                    Loading.ShowLoading(((a - 1) / (float)list.Count) * 100.0 + "% " + options.softwares[a].name, this);

                    List <Task <bool> > tasklist = new List <Task <bool> >();

                    foreach (var field in members)
                    {
                        if (field.Name.ToLower().Contains("url"))
                        {
                            var url = field.GetValue(options.softwares[a]).ToString();

                            if (String.IsNullOrEmpty(url))
                            {
                                continue;
                            }

                            field.SetValue(options.softwares[a], new Uri(url).LocalPath.TrimStart('/', '\\'));

                            var task = Download.getFilefromNetAsync(url, basedir + new Uri(url).LocalPath);
                            tasklist.Add(task);
                        }
                    }

                    //Task.WaitAll(tasklist.ToArray());
                }

                XmlSerializer xms = new XmlSerializer(typeof(optionsObject), new Type[] { typeof(software) });

                xms.Serialize(xmlwriter, options);
            }
            Loading.Close();
        }
 private void TimerCallBack(object sender, EventArgs e)
 {
     try {
         loading.label_status.Content = runningStatus;
         if (hasError)
         {
             timer.Stop();
             loading.Close();
         }
         if (isFinishedThread)
         {
             new Login().Show();
             timer.Stop();
             loading.Close();
         }
     } catch (Exception) {
     }
 }
Esempio n. 8
0
        private void queueRunner(object nothing)
        {
            Parallel.ForEach(files, file => { ProcessFile(file); });

            Loading.ShowLoading("Populating Data", this);

            objectListView1.AddObjects(logs);

            Loading.Close();
        }
Esempio n. 9
0
        //Download Button
        private void button6_Click(object sender, EventArgs e)
        {
            Loading loadingForm = new Loading();

            loadingForm.Show();
            Application.DoEvents();
            if (title.Text != string.Empty)
            {
                string DownloadName = "";
                #region OLD CHECK

                /*
                 * switch (comboBox1.SelectedText)
                 * {
                 *  case "Sleepcasts|SLEEP|41":
                 *  case "Nighttime SOS|SLEEP|47":
                 *  case "SOS|MEDITATE|59":
                 *      //Sleepcast and SOS
                 *      DownloadName = Download_Definitive();
                 *      break;
                 *  default:
                 *      //Wind Down, Sleepmusic, Soundscape, Sleep Radio
                 *      DownloadName = Download_Various();
                 *      break;
                 * }
                 */
                #endregion

                if (File.ReadAllLines("Variable.txt").Contains(comboBox1.SelectedItem.ToString()))
                {
                    DownloadName = Download_Various();
                }
                else if (File.ReadAllLines("Definitive.txt").Contains(comboBox1.SelectedItem.ToString()))
                {
                    DownloadName = Download_Definitive();
                }
                else
                {
                    DownloadName = Download_Definitive();
                }

                loadingForm.Close();
                if (File.Exists(DownloadName) || !autoMerge.Checked)
                {
                    MessageBox.Show("Done");
                    button2.Enabled = true;
                    button3.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Missing required audio file. File seems to have failed to download.", "Error");
                }
            }
        }
Esempio n. 10
0
        private void queueRunner(object nothing)
        {
            Parallel.ForEach(files, async(file) => { await ProcessFile(file).ConfigureAwait(false); });

            Loading.ShowLoading("Populating Data", this);

            this.BeginInvokeIfRequired(a =>
            {
                objectListView1.AddObjects(logs);
            });

            Loading.Close();
        }
Esempio n. 11
0
        void queueRunner(object nothing)
        {
            lock (threads)
                threads.Add(Thread.CurrentThread);

            while (true)
            {
                string file = "";
                lock (files)
                {
                    if (IsDisposed)
                    {
                        return;
                    }

                    if (files.Count == 0)
                    {
                        break;
                    }

                    Loading.ShowLoading("Files loading left " + files.Count, this);

                    file = files[0];
                    files.RemoveAt(0);
                }

                if (File.Exists(file))
                {
                    processbg(file);
                }
            }

            if (threads[0] != Thread.CurrentThread)
            {
                return;
            }

            while (threads.Count > 1)
            {
                threads[1].Join();
                threads.RemoveAt(1);
                System.Threading.Thread.Sleep(1000);
                Loading.ShowLoading("Waiting for threads to finish", this);
            }

            Loading.ShowLoading("Populating Data", this);

            objectListView1.AddObjects(logs);

            Loading.Close();
        }
Esempio n. 12
0
 public void button1_Click(object sender, EventArgs e)
 {
     Loading l = new Loading();
     try
     {
         button1.Enabled = false;
         button2.Enabled = false;
         this.Hide();
         l.Show();
         l.Refresh();
         readAllResourceFiles(txtBoxPath.Text.ToString());
         l.Close();
         this.Close();
     }
     catch (Exception exce)
     {
         MessageBox.Show(exce.Message);
         this.Show();
         l.Close();
         button1.Enabled = true;
         button2.Enabled = true;
     }
 }
Esempio n. 13
0
 public void ControlURLRewrite(bool rewritePrestashop)
 {
     try
     {
         Loading Loading = new Loading();
         Loading.Show();
         ControlURLRewrite control = new ControlURLRewrite(rewritePrestashop);
         Loading.Close();
         control.ShowDialog();
     }
     catch (Exception ex)
     {
         Core.Error.SendMailError(ex.ToString());
     }
 }
Esempio n. 14
0
 public void ControleMappageArticles(Boolean Actif)
 {
     try
     {
         Loading Loading = new Loading();
         Loading.Show();
         ControlArticle control = new ControlArticle(Actif);
         Loading.Close();
         control.ShowDialog();
     }
     catch (Exception ex)
     {
         Core.Error.SendMailError(ex.ToString());
     }
 }
Esempio n. 15
0
        private async void MainForm_Load(object sender, System.EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            var loginForm = new LoginForm();
            await Loading.Close();

            if (loginForm.ShowDialog() == DialogResult.OK)
            {
                Display = true;
            }
            else
            {
                Application.Exit();
            }
            Cursor = Cursors.Default;
        }
Esempio n. 16
0
        private void but_GDAL_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                if (Directory.Exists(fbd.SelectedPath))
                {
                    GDAL.GDAL.OnProgress += GDAL_OnProgress;
                    GDAL.GDAL.ScanDirectory(fbd.SelectedPath);
                    DTED.OnProgress += GDAL_OnProgress;
                    DTED.AddCustomDirectory(fbd.SelectedPath);

                    Loading.Close();
                }
            }
        }
Esempio n. 17
0
        private async void DadosTesteAtual_Load(object sender, EventArgs e)
        {
            FocusMe();

            lblTemperatura.Text = TemperatureSubscriber.Temperature + " °C";

            metroComboBox1.SelectedIndex = I18nUtils.GetComboLangSelectedIndex();
            metroComboBox2.SelectedIndex = 0;
            metroTextBox1.Focus();
            metroGrid1.UseSelectable = false;
            labelUsername.Text       = Properties.Settings.Default.Username;

            ChangePanelVisibility(false);

            if (Properties.Settings.Default.IsOffline)
            {
                TesteTermicoDTO    = LocalFiberService.GetUltimoTesteTermicoSalvoNoArquivo();
                metroTextBox1.Text = TesteTermicoDTO.CodigoRequisicao.Split('/')[0];
                timerCheckFiber.Start();

                AtualizaListaTestes();
                ChangeAllButtons(false);
            }
            else
            {
                if (LocalFiberService.IsNecessarioSincronizar())
                {
                    ChangeAllButtons(false);
                    Loading loading = new Loading
                    {
                        Titulo = GetI18nMessage("sincronizandoTestes")
                    };

                    loading.Show();

                    Task task = new Task(SincronizarTestes);
                    task.Start();
                    await task;

                    ChangeAllButtons(true);
                    loading.Close();
                }
            }
        }
Esempio n. 18
0
 private void LoadClose()
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action(LoadClose), new object[] { });
     }
     else
     {
         ld.Close();
         new Thread(() =>
         {
             Thread.Sleep(500);
             isSubmit = true;
         })
         {
             IsBackground = true
         }.Start();
     }
 }
Esempio n. 19
0
        public static async System.Threading.Tasks.Task <bool> DownloadAsync(string sourceWebAddress, string destPath, string fileName)
        {
            var destFullPath = Path.Combine(destPath, fileName);

            try
            {
                Loading             loadingWindow;
                HttpResponseMessage response;
                using (var cancellationTokenSource = new CancellationTokenSource())
                {
                    cancellationTokenSource.CancelAfter(new TimeSpan(0, 0, 2, 30));
                    loadingWindow = new Loading(cancellationTokenSource);

                    loadingWindow.Show();
                    var httpClient = new HttpClient();
                    response = await httpClient.GetAsync(sourceWebAddress, HttpCompletionOption.ResponseContentRead, cancellationTokenSource.Token);
                }

                response.EnsureSuccessStatusCode();

                using (var fileStream = new FileStream(destFullPath, FileMode.Create, FileAccess.Write, FileShare.None))
                    await response.Content.CopyToAsync(fileStream);

                loadingWindow.Close();
                return(true);
            }
            catch (HttpRequestException ex)
            {
                MessageBox.Show($"Error in downloading template file \n {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (OperationCanceledException ex)
            {
                MessageBox.Show("Project template download canceled.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error in downloading template file \n {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
Esempio n. 20
0
        public List <string> Convert()
        {
            List <string> slides = new List <string>();
            Loading       load   = new Loading();

            load.Show();
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            Application  ppt  = new Application();
            Presentation pres = ppt.Presentations.Open(file, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);

            foreach (Slide slide in pres.Slides)
            {
                slide.Export(string.Format(folder + @"\Slide{0}.jpg", slide.SlideIndex), "jpg");
                slides.Add(string.Format(folder + @"\Slide{0}.jpg", slide.SlideIndex));
            }
            load.Close();
            load.Dispose();
            return(slides);
        }
Esempio n. 21
0
 public void ClearPsImage()
 {
     try
     {
         Boolean CanClear = true;
         Model.Prestashop.PsConfigurationRepository PsConfigurationRepository = new Model.Prestashop.PsConfigurationRepository();
         if (PsConfigurationRepository.ExistName("PS_LEGACY_IMAGES"))
         {
             Model.Prestashop.PsConfiguration image_storage_mode = PsConfigurationRepository.ReadName("PS_LEGACY_IMAGES");
             int value;
             if (int.TryParse(image_storage_mode.Value, out value))
             {
                 if (value != (short)Core.Global.GetConfig().ConfigImageStorageMode)
                 {
                     if (MessageBox.Show("Attention le système de stockage paramétré dan PrestaConnect est différent de celui de PrestaShop !\n"
                                         + "Êtes-vous sûrs de vouloir nettoyer la table ps_image selon la présence des fichiers sur le FTP ?",
                                         "Mode de stockage des images", MessageBoxButton.OK, MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                     {
                         CanClear = false;
                     }
                 }
             }
         }
         if (CanClear)
         {
             Loading Loading = new Loading();
             Loading.Show();
             NettoyageImage clear = new NettoyageImage();
             Loading.Close();
             clear.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         Core.Error.SendMailError(ex.ToString());
     }
 }
Esempio n. 22
0
        private void but_getfw_Click(object sender, EventArgs e)
        {
            var basedir = Settings.GetDataDirectory() + "History";

            Directory.CreateDirectory(basedir);

            var fw = new Firmware();

            var list = fw.getFWList();

            using (
                var xmlwriter = new XmlTextWriter(basedir + Path.DirectorySeparatorChar + @"firmware2.xml",
                                                  Encoding.ASCII))
            {
                xmlwriter.Formatting = Formatting.Indented;

                xmlwriter.WriteStartDocument();

                xmlwriter.WriteStartElement("options");

                int a = 0;

                foreach (var software in list)
                {
                    a++;
                    Loading.ShowLoading(((a - 1) / (float)list.Count) * 100.0 + "% " + software.name, this);

                    //if (!software.name.Contains("Copter"))
                    //  continue;

                    xmlwriter.WriteStartElement("Firmware");

                    if (software.url != "")
                    {
                        xmlwriter.WriteElementString("url", new Uri(software.url).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.url2560 != "")
                    {
                        xmlwriter.WriteElementString("url2560", new Uri(software.url2560).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.url2560_2 != "")
                    {
                        xmlwriter.WriteElementString("url2560-2",
                                                     new Uri(software.url2560_2).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlpx4v1 != "")
                    {
                        xmlwriter.WriteElementString("urlpx4", new Uri(software.urlpx4v1).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlpx4v2 != "")
                    {
                        xmlwriter.WriteElementString("urlpx4v2",
                                                     new Uri(software.urlpx4v2).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlpx4v4 != "")
                    {
                        xmlwriter.WriteElementString("urlpx4v4",
                                                     new Uri(software.urlpx4v4).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlpx4v4pro != "")
                    {
                        xmlwriter.WriteElementString("urlpx4v4pro",
                                                     new Uri(software.urlpx4v4pro).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrbrainv40 != "")
                    {
                        xmlwriter.WriteElementString("urlvrbrainv40",
                                                     new Uri(software.urlvrbrainv40).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrbrainv45 != "")
                    {
                        xmlwriter.WriteElementString("urlvrbrainv45",
                                                     new Uri(software.urlvrbrainv45).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrbrainv50 != "")
                    {
                        xmlwriter.WriteElementString("urlvrbrainv50",
                                                     new Uri(software.urlvrbrainv50).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrbrainv51 != "")
                    {
                        xmlwriter.WriteElementString("urlvrbrainv51",
                                                     new Uri(software.urlvrbrainv51).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrbrainv52 != "")
                    {
                        xmlwriter.WriteElementString("urlvrbrainv52",
                                                     new Uri(software.urlvrbrainv52).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrcorev10 != "")
                    {
                        xmlwriter.WriteElementString("urlvrcorev10",
                                                     new Uri(software.urlvrcorev10).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrubrainv51 != "")
                    {
                        xmlwriter.WriteElementString("urlvrubrainv51",
                                                     new Uri(software.urlvrubrainv51).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlvrubrainv52 != "")
                    {
                        xmlwriter.WriteElementString("urlvrubrainv52",
                                                     new Uri(software.urlvrubrainv52).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urlbebop2 != "")
                    {
                        xmlwriter.WriteElementString("urlbebop2",
                                                     new Uri(software.urlbebop2).LocalPath.TrimStart('/', '\\'));
                    }
                    if (software.urldisco != "")
                    {
                        xmlwriter.WriteElementString("urldisco",
                                                     new Uri(software.urldisco).LocalPath.TrimStart('/', '\\'));
                    }
                    xmlwriter.WriteElementString("name", software.name);
                    xmlwriter.WriteElementString("desc", software.desc);
                    xmlwriter.WriteElementString("format_version", software.k_format_version.ToString());

                    xmlwriter.WriteEndElement();

                    if (software.url != "")
                    {
                        Download.getFilefromNet(software.url, basedir + new Uri(software.url).LocalPath);
                    }
                    if (software.url2560 != "")
                    {
                        Download.getFilefromNet(software.url2560, basedir + new Uri(software.url2560).LocalPath);
                    }
                    if (software.url2560_2 != "")
                    {
                        Download.getFilefromNet(software.url2560_2, basedir + new Uri(software.url2560_2).LocalPath);
                    }
                    if (software.urlpx4v1 != "")
                    {
                        Download.getFilefromNet(software.urlpx4v1, basedir + new Uri(software.urlpx4v1).LocalPath);
                    }
                    if (software.urlpx4v2 != "")
                    {
                        Download.getFilefromNet(software.urlpx4v2, basedir + new Uri(software.urlpx4v2).LocalPath);
                    }
                    if (software.urlpx4v4 != "")
                    {
                        Download.getFilefromNet(software.urlpx4v4, basedir + new Uri(software.urlpx4v4).LocalPath);
                    }
                    if (software.urlpx4v4pro != "")
                    {
                        Download.getFilefromNet(software.urlpx4v4pro, basedir + new Uri(software.urlpx4v4pro).LocalPath);
                    }

                    if (software.urlvrbrainv40 != "")
                    {
                        Download.getFilefromNet(software.urlvrbrainv40,
                                                basedir + new Uri(software.urlvrbrainv40).LocalPath);
                    }
                    if (software.urlvrbrainv45 != "")
                    {
                        Download.getFilefromNet(software.urlvrbrainv45,
                                                basedir + new Uri(software.urlvrbrainv45).LocalPath);
                    }
                    if (software.urlvrbrainv50 != "")
                    {
                        Download.getFilefromNet(software.urlvrbrainv50,
                                                basedir + new Uri(software.urlvrbrainv50).LocalPath);
                    }
                    if (software.urlvrbrainv51 != "")
                    {
                        Download.getFilefromNet(software.urlvrbrainv51,
                                                basedir + new Uri(software.urlvrbrainv51).LocalPath);
                    }
                    if (software.urlvrbrainv52 != "")
                    {
                        Download.getFilefromNet(software.urlvrbrainv52,
                                                basedir + new Uri(software.urlvrbrainv52).LocalPath);
                    }
                    if (software.urlvrcorev10 != "")
                    {
                        Download.getFilefromNet(software.urlvrcorev10, basedir + new Uri(software.urlvrcorev10).LocalPath);
                    }
                    if (software.urlvrubrainv51 != "")
                    {
                        Download.getFilefromNet(software.urlvrubrainv51,
                                                basedir + new Uri(software.urlvrubrainv51).LocalPath);
                    }
                    if (software.urlvrubrainv52 != "")
                    {
                        Download.getFilefromNet(software.urlvrubrainv52,
                                                basedir + new Uri(software.urlvrubrainv52).LocalPath);
                    }
                    if (software.urlbebop2 != "")
                    {
                        Download.getFilefromNet(software.urlbebop2,
                                                basedir + new Uri(software.urlbebop2).LocalPath);
                    }
                    if (software.urldisco != "")
                    {
                        Download.getFilefromNet(software.urldisco,
                                                basedir + new Uri(software.urldisco).LocalPath);
                    }
                }

                xmlwriter.WriteEndElement();
                xmlwriter.WriteEndDocument();
            }

            Loading.Close();
        }
Esempio n. 23
0
        public static string CheckLogFile(string FileName)
        {
            if (Program.WindowsStoreApp)
            {
                CustomMessageBox.Show(Strings.Not_available_when_used_as_a_windows_store_app);
                return("");
            }

            var dir = Settings.GetDataDirectory() + "LogAnalyzer" +
                      Path.DirectorySeparatorChar;

            var runner = dir + "runner.exe";

            var zip = dir + "LogAnalyzer.zip";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            //if (!File.Exists(runner))
            {
                Loading.ShowLoading("Downloading LogAnalyzer");
                bool gotit = false;
                if (Environment.Is64BitOperatingSystem)
                {
                    gotit = Common.getFilefromNet(
                        "http://firmware.ardupilot.org/Tools/MissionPlanner/LogAnalyzer/LogAnalyzer64.zip",
                        zip);
                }
                else
                {
                    gotit = Common.getFilefromNet(
                        "http://firmware.ardupilot.org/Tools/MissionPlanner/LogAnalyzer/LogAnalyzer.zip",
                        zip);
                }

                // download zip
                if (gotit)
                {
                    Loading.ShowLoading("Extracting zip file");
                    // extract zip
                    FastZip fzip = new FastZip();
                    fzip.ExtractZip(zip, dir, "");
                }
                else
                {
                    if (!File.Exists(runner))
                    {
                        CustomMessageBox.Show("Failed to download LogAnalyzer");
                        return("");
                    }
                }
            }

            if (!File.Exists(runner))
            {
                CustomMessageBox.Show("Failed to download LogAnalyzer");
                return("");
            }

            var sb = new StringBuilder();

            Process P = new Process();

            P.StartInfo.FileName  = runner;
            P.StartInfo.Arguments = @" -x """ + FileName + @".xml"" -s """ + FileName + @"""";

            P.StartInfo.UseShellExecute  = false;
            P.StartInfo.WorkingDirectory = dir;

            P.StartInfo.RedirectStandardOutput = true;
            P.StartInfo.RedirectStandardError  = true;

            P.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data);
            P.ErrorDataReceived  += (sender, args) => sb.AppendLine(args.Data);

            try
            {
                Loading.ShowLoading("Running LogAnalyzer");

                P.Start();

                P.BeginOutputReadLine();
                P.BeginErrorReadLine();

                // until we are done
                P.WaitForExit();

                log.Info(sb.ToString());
            }
            catch
            {
                CustomMessageBox.Show("Failed to start LogAnalyzer");
            }

            Loading.Close();

            return(FileName + ".xml");
        }
Esempio n. 24
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            if (running)
            {
                using (Loading loadingForm = new Loading())
                {
                    GameTime gameTime = new GameTime(TimeSpan.Zero, TimeSpan.Zero);
                    loadingForm.Show();

                    loadingForm.SetLabel("Loading graphics device tools...");
                    spriteBatch = new SpriteBatch(GraphicsDevice);

                    loadingForm.SetLabel("Loading content...");
                    contentRepository.LoadContent();

                    loadingForm.SetLabel("Loading gun types...");
                    LoadGunTypes();

                    player   = new Player(this);
                    opponent = new Opponent(this);

                    town = new Town(this, loadingForm);

                    loadingForm.SetLabel("Loading player...");
                    loadingForm.SetValue(0);
                    Point          playerPoint    = town.CurrentQuarter.GetRandomSquare(s => s == MapFillType.Sidewalk);
                    PositionInTown playerPosition = new PositionInTown(town.CurrentQuarter, playerPoint.ToVector2() * TownQuarter.SquareWidth + Vector2.One * 0.5f * TownQuarter.SquareWidth);
                    player.Load(contentRepository.Player, playerPosition, MathHelper.PiOver2, drawer.WorldTransformMatrix);
                    town.CurrentQuarter.SpaceGrid.AddObject(player);
                    town.CurrentQuarter.SetOwner(player, gameTime);
                    player.AddEnemy(opponent);

                    loadingForm.SetLabel("Loading opponent...");
                    loadingForm.SetValue(0);
                    TownQuarter    oppQuarter  = (from q in town.Quarters where q != town.CurrentQuarter orderby random.Next() select q).First();
                    Point          oppPoint    = oppQuarter.GetRandomSquare(s => s == MapFillType.Sidewalk);
                    PositionInTown oppPosition = new PositionInTown(oppQuarter, oppPoint.ToVector2() * TownQuarter.SquareWidth);
                    opponent.Load(contentRepository.Opponent, oppPosition, 0, drawer.WorldTransformMatrix);
                    oppQuarter.BeEnteredBy(opponent);
                    oppQuarter.SetOwner(opponent, gameTime);
                    opponent.AddEnemy(player);
                    Components.Add(town);


                    BulletVisualisation.Texture = Content.Load <Texture2D>("Textures/white");
                    backgroundSound             = Content.Load <SoundEffect>("Sounds/background").CreateInstance();

                    loadingForm.SetLabel("Cleaning memory...");
                    loadingForm.SetValue(0);
                    GC.Collect();
                    loadingForm.SetValue(100);

                    loadingForm.SetLabel("Content loaded. Get ready to play!");
                    loadingForm.SetValue(100);
                    loadingForm.Close();

                    backgroundSound.IsLooped = true;
                    backgroundSound.Play();
                    drawer.ShowMessage(new GameTime(), String.Format("Wellcome in the game. You're in {0}.", player.Position.Quarter.Name));
                }
                if (settings.Fullscreen)
                {
                    graphics.ToggleFullScreen();
                }
            }
        }
Esempio n. 25
0
        private async void btnAcceder_Click(object sender, EventArgs e)  //Metodo asincrono para acceder a pantalla principal
        {
            if (txtUsername.Text != "User name" && txtPassword.Text != "Password")
            {
                string rutaArchivoCompleta = PathA + "Usuarios.xlsx";


                //Ingreso User name y Password
                lblAsteriscoUser.Visible = false;
                txtUsername.ForeColor    = Color.Silver;
                lblArteriscoPass.Visible = false;
                txtPassword.ForeColor    = Color.Silver;
                if (File.Exists(rutaArchivoCompleta)) //Pregrunto si el archivo existe
                {
                    SLDocument ArchivoExcel = new SLDocument(rutaArchivoCompleta);
                    int        iRow         = 2;
                    while (!string.IsNullOrEmpty(ArchivoExcel.GetCellValueAsString(iRow, 1)))
                    {
                        if (txtUsername.Text == ArchivoExcel.GetCellValueAsString(iRow, 2) && txtPassword.Text == ArchivoExcel.GetCellValueAsString(iRow, 3)) //Recorro el archivo y pregunto si existen las credenciales
                        {
                            encontrado = true;
                            IdUser     = ArchivoExcel.GetCellValueAsDouble(iRow, 1); //Obtengo el Id de Usuario
                        }

                        iRow++;
                    }
                    //Verificar si las credenciales son correctas
                    if (encontrado)
                    {
                        loading = new Loading();
                        FormPrincipal frmprincipal = new FormPrincipal(IdUser); //Paso como parametro al Id de usuario al formulario principal

                        //frmprincipal.WindowState = FormWindowState.Maximized;
                        loading.Show(); // Mostrar el loading
                        Task oTask = new Task(TiempoEspera);
                        oTask.Start();  // Se ejecuta el metodo asincrono
                        await oTask;
                        if (loading != null)
                        {
                            loading.Close();
                            frmprincipal.Show();
                            this.Visible = false;
                            frmprincipal.btnPerfil_Click(sender, e);
                        } //Ocultar el loading
                    }
                    else
                    {
                        MessageBox.Show("¡El usuario o contraseña son incorrectos!");
                    }
                }
                else
                {
                    MessageBox.Show("¡Lo sentimos... No hay usuarios registrados!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtUsername.Text = "User name";
                    txtPassword.Text = "Password";
                    txtPassword.UseSystemPasswordChar = false;
                }
            }
            else if (txtUsername.Text == "User name" && txtPassword.Text == "Password")
            {
                lblAsteriscoUser.Visible = true;
                txtUsername.ForeColor    = Color.Red;
                lblArteriscoPass.Visible = true;
                txtPassword.ForeColor    = Color.Red;
            }
            else if (txtUsername.Text == "User name" && txtPassword.Text != "Password")
            {
                lblAsteriscoUser.Visible = true;
                txtUsername.ForeColor    = Color.Red;
                lblArteriscoPass.Visible = false;
            }
            else if (txtUsername.Text != "User name" && txtPassword.Text == "Password")
            {
                lblAsteriscoUser.Visible = false;
                lblArteriscoPass.Visible = true;
                txtPassword.ForeColor    = Color.Red;
            }
            else if (txtUsername.Text == "" && txtPassword.Text == "Password")
            {
                lblAsteriscoUser.Visible = true;
                txtUsername.ForeColor    = Color.Red;
                lblArteriscoPass.Visible = true;
                txtPassword.ForeColor    = Color.Red;
            }
            else if (txtUsername.Text == "User name" && txtPassword.Text == "")
            {
                lblAsteriscoUser.Visible = true;
                txtUsername.ForeColor    = Color.Red;
                lblArteriscoPass.Visible = true;
                txtPassword.ForeColor    = Color.Red;
            }
        }
Esempio n. 26
0
 public void Message()
 {
     frmLoading.Close();
     Enabled = true;
 }
Esempio n. 27
0
        // Runs the given Action on the background worker
        private void runTaskWithLoadingScreen(string loadingMessage, string loadingTitle, Action work)
        {

            // Create variables used in loading (maz load value, background worker, and loading screen)
                int maxLoadValue = mazeWidth * mazeHeight;
                worker = new BackgroundWorker();
                loading = new Loading();

            // Set the background worker to run the given method
                worker.DoWork += (sender, e) => work();

            // Se the background worker to return the cursor and close the loading screen when it's done
                worker.RunWorkerCompleted += (sender, e) =>
                {
                    loading.Close();
                    Mouse.OverrideCursor = null;
                };

            // Set the background worker to increment the loading value and update time remaining on update
                    worker.ProgressChanged += (sender, e) =>
                    {
                        loading.LoadingValue+=e.ProgressPercentage/100.0;
                        if ((int)loading.LoadingValue % 200 == 0)
                        {
                            if ((int)loading.LoadingValue / 200 % 3 == 0)
                                loading.LoadingMessage = loadingMessage + "..";
                            else if ((int)loading.LoadingValue / 200 % 3 == 1)
                                loading.LoadingMessage = loadingMessage + "...";
                            else if ((int)loading.LoadingValue / 200 % 3 == 2)
                                loading.LoadingMessage = loadingMessage + ".";
                        }
                    };
                        worker.WorkerReportsProgress = true;


                        // Show the loading screen, change the cursour, and run the background worker
                        loading.Show(this, loadingMessage+"...", loadingTitle, maxLoadValue);
                        Mouse.OverrideCursor = Cursors.Wait;
                        worker.RunWorkerAsync();

                    }