Exemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)          //界面加载事件
 {
     logshow(TitleText);
     myDeleteage         = logshow;
     buttonDelegate      = ButtonSwitch;
     progressBarDelegate = ProgressBarShow;
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ValidarTokenBackGruondWorker();
            snackBarDelegate               = new SnackBarDelegate(EstadoSnackBar);
            progressBarDelegate            = new ProgressBarDelegate(EstadoProgressBar);
            iniRehabBtnDelegate            = new IniRehabBtnDelegate(EstadoIniciarRehabilitacion);
            labelNombreDelegate            = new LabelNombreDelegate(LlenarNombrePaciente);
            labelIdDelegate                = new LabelIdDelegate(LlenarId);
            pacienteCardDelegate           = new PacienteCardDelegate(EstadoPacienteCard);
            nombreEjercicioDelegate        = new NombreEjercicioDelegate(LlenarNombreEjercicio);
            dificultadEjercicioDelegate    = new DificultadEjercicioDelegate(LlenarDificultadEjercicio);
            repeticionesEjercicioDelegate  = new RepeticionesEjercicioDelegate(LlenarRepeticiones);
            iconoTokenDelegate             = new IconoTokenDelegate(EstadoIconoToken);
            dNIPacienteDelegate            = new DNIPacienteDelegate(EstadoDNIPaciente);
            sesionPacienteDelegate         = new SesionPacienteDelegate(EstadoSesionId);
            tokenButtonDelegate            = new ValidarTokenButtonDelegate(EstadoValidarTokenBtn);
            ratingBarDelegate              = new RatingBarDelegate(EstadoRatingBar);
            estadoGeneralDelegate          = new EstadoGeneralDelegate(EstadoGeneral);
            atrasBtnDelegate               = new AtrasBtnDelegate(EstadoAtrasBtn);
            sinConexionCardDelegate        = new SinConexionCardDelegate(EstadoSinConexionCard);
            sinConexionTextBlockDelegate   = new SinConexionTextBlockDelegate(EstadoSinConexiónTextBlock);
            tokenInvalidoTextBlockDelegate = new TokenInvalidoTextBlockDelegate(EstadoTokenInvalidoTextBlock);


            Sesion    = new SesionViewModel();
            Ejercicio = new RepeticionViewModel();
            DNITextBox.Focus();
        }
Exemplo n.º 3
0
        public void InvokePb(int values)
        {
            object val = values;

            myPb = PbDel;
            _bar.Invoke(myPb, val);
        }
        public void ButtonWonder_Click(object sender, RoutedEventArgs e)
        {
            globalFuncs.scoutTimer.start();

            if (searching)
            {
                stopSearching = true;
                searching     = false;
                return;
            }

            this.windowMain.CurrentGameDate.Text      = context.fm.MetaData.IngameDate.ToLongDateString();
            this.windowMain.vm.tabteams.TextBlockText = globalFuncs.localization.WindowMainLabels[2];
            this.vm.wonder.TextBlockText = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_STOP];
            //this.ButtonWonder.IsEnabled = false;
            this.vm.results.Text = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_SEARCHING] + "...";
            setControlAvailability(false);
            this.ButtonSearch.IsEnabled = false;

            SearchDelegate d = new SearchDelegate(this.retrieveFieldsWonder);

            d.BeginInvoke(null, null);
            ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar);

            p.BeginInvoke(null, null);
        }
Exemplo n.º 5
0
        public void addToShortlist(ref DataGrid playerDataGrid)
        {
            List <int> playerRows = new List <int>();

            for (int i = 0; i < playerDataGrid.SelectedItems.Count; ++i)
            {
                PlayerGridViewModel row = (PlayerGridViewModel)playerDataGrid.SelectedItems[i];
                if (!context.shortlistIDList.Contains(row.ID))
                {
                    playerRows.Add(row.ID);
                }
            }

            if (playerRows.Count > 0)
            {
                globalFuncs.scoutTimer.start();
                this.windowMain.CurrentGameDate.Text          = context.fm.MetaData.IngameDate.ToLongDateString();
                this.windowMain.vm.tabshortlist.TextBlockText = globalFuncs.localization.WindowMainLabels[3];
                setControlAvailability(false);
                this.vm.results.Text = "Importing...";

                LoadDelegate d = new LoadDelegate(this.loadShortlistPlayers);
                d.BeginInvoke(ref playerRows, null, null);
                ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar);
                p.BeginInvoke(null, null);
            }
        }
Exemplo n.º 6
0
    IEnumerator LoadLevelScene(int scene, ProgressBarDelegate progressDelegate)
    {
        AsyncOperation async = SceneManager.LoadSceneAsync(scene);

        while (!async.isDone)
        {
            progressDelegate(async.progress);
            async.allowSceneActivation = async.progress > 0.80; // waiting until 80%
            yield return(null);
        }
    }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     EjercicioTabla();
     progressBarDelegate       = new ProgressBarDelegate(EstadoProgressBar);
     ejerciciosDatGridDelegate = new EjerciciosDatGridDelegate(LlenarTabla);
     snackBarDelegate          = new SnackBarDelegate(EstadoSnackBar);
     if (!ejerciciosBG.IsBusy)
     {
         ejerciciosBG.RunWorkerAsync();
     }
 }
Exemplo n.º 8
0
 public void UpdateProgressBar(int i)
 {
     if (!progressBar1.InvokeRequired)
     {
         progressBar1.Value = i;
     }
     else
     {
         ProgressBarDelegate progressBarDeleg = new ProgressBarDelegate(UpdateProgressBar);
         progressBar1.Invoke(progressBarDeleg, new object[] { i });
     }
 }
Exemplo n.º 9
0
 public void ProgressToggle(bool visible)
 {
     if (!progressBar1.InvokeRequired)
     {
         progressBar1.Visible = visible;
     }
     else
     {
         ProgressBarDelegate d = new ProgressBarDelegate(ProgressToggle);
         this.Invoke(d, new object[] { visible });
     }
 }
Exemplo n.º 10
0
 public void UpdateProgressBar(int value)
 {
     if (progressBar.InvokeRequired)
     {
         var d = new ProgressBarDelegate(UpdateProgressBar);
         progressBar.Invoke(d, new object[] { value });
     }
     else
     {
         progressBar.Value = value;
     }
 }
Exemplo n.º 11
0
 private void InvokeProgBarTick(int value)
 {
     if (progBar.InvokeRequired)
     {
         ProgressBarDelegate p = new ProgressBarDelegate(InvokeProgBarTick);
         this.Invoke(p, new object[] { value });
     }
     else
     {
         progBar.Value = value;
     }
 }
Exemplo n.º 12
0
        public void ButtonSearch_Click(object sender, RoutedEventArgs e)
        {
            globalFuncs.scoutTimer.start();

            if (searching)
            {
                stopSearching = true;
                searching     = false;
                return;
            }

            this.windowMain.CurrentGameDate.Text      = context.fm.MetaData.IngameDate.ToLongDateString();
            this.windowMain.vm.tabteams.TextBlockText = globalFuncs.localization.WindowMainLabels[2];
            this.vm.search.TextBlockText = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_STOP];
            //this.ButtonSearch.IsEnabled = false;
            setControlAvailability(false);
            this.ButtonWonder.IsEnabled = false;
            this.vm.results.Text        = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_SEARCHING] + "...";

            searchUI.name    = this.name.TextBox.Text.ToLower();
            searchUI.nation  = this.nation.TextBox.Text.ToLower();
            searchUI.stadium = this.stadium.TextBox.Text.ToLower();
            globalFuncs.specialCharactersReplacement(ref searchUI.name);
            globalFuncs.specialCharactersReplacement(ref searchUI.nation);
            globalFuncs.specialCharactersReplacement(ref searchUI.stadium);
            searchUI.teamtypeIndex = this.teamtype.ComboBox.SelectedIndex;
            if (this.teamtype.ComboBox.SelectedItem != null)
            {
                searchUI.teamtypeItem = (String)this.teamtype.ComboBox.SelectedItem;
            }
            searchUI.regionIndex = this.region.ComboBox.SelectedIndex;
            if (this.region.ComboBox.SelectedItem != null)
            {
                searchUI.regionItem = globalFuncs.localization.regionsNative[searchUI.regionIndex];
            }
            searchUI.reputationIndex = this.reputation.ComboBox.SelectedIndex;
            if (this.reputation.ComboBox.SelectedItem != null)
            {
                searchUI.reputationItem = (String)this.reputation.ComboBox.SelectedItem;
            }
            searchUI.transferBudgetMin = (int)this.transferBudget.NumericUpDownMin.Value;
            searchUI.transferBudgetMax = (int)this.transferBudget.NumericUpDownMax.Value;
            searchUI.wageBudgetMin     = (int)this.wageBudget.NumericUpDownMin.Value;
            searchUI.wageBudgetMax     = (int)this.wageBudget.NumericUpDownMax.Value;

            SearchDelegate d = new SearchDelegate(this.retrieveFields);

            d.BeginInvoke(null, null);
            ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar);

            p.BeginInvoke(null, null);
        }
Exemplo n.º 13
0
        private void TFTP_OnTransferFinish()
        {
            ProgressBarDelegate progressBarDel = new ProgressBarDelegate(ProgressBarDelegateFunction);

            progressBar.Invoke(progressBarDel, new object[2] {
                0, 0
            });

            Console.WriteLine("\nTransfer Finished");

            MessageBox.Show("Transfer Complete", "TFTP Client",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 14
0
 /// <summary>
 /// 进度条
 /// </summary>
 /// <param name="msg"></param>
 public static void SetProgressBarValue(int max, int value)
 {
     if (mainForm.InvokeRequired)
     {
         ProgressBarDelegate d = new ProgressBarDelegate(SetProgressBarValue);
         mainForm.Invoke(d, max, value);
     }
     else
     {
         toolStripProgressBar_main.Maximum = max;
         toolStripProgressBar_main.Value   = value;
     }
 }
Exemplo n.º 15
0
        void ProcessDrag(object obj)
        {
            PutLogDelegate      putlog     = PutLog;
            MessageBoxDelegate  messagebox = ShowMessage;
            ProgressBarDelegate progress   = SetProgress;

            DateTime curTime = System.DateTime.Now;
            string   time    = string.Format("{0}_{1}_{2}-{3}_{4}_{5}", curTime.Year, curTime.Month, curTime.Day, curTime.Hour, curTime.Minute, curTime.Second);

            Options option = new Options();

            option.HeaderRows  = 1;
            option.WorkOut     = "输出目录";
            option.json        = this.checkJson.Checked;
            option.csv         = this.checkCSV.Checked;
            option.xml         = this.checkXml.Checked;
            option.sqlite      = this.checkSqlite.Checked;
            option.mysql       = this.checkMySql.Checked;
            option.csharp      = this.checkCSharp.Checked;
            option.ExportArray = this.checkArray.Checked;
            option.SQLPath     = string.Format("{0}/{1}", option.WorkOut, time);
            option.CSharpPath  = string.Format("{0}/{1}.cs", option.WorkOut, time);

            if (Directory.Exists(option.WorkOut) == false)
            {
                Directory.CreateDirectory(option.WorkOut);
            }

            List <string> list = obj as List <string>;

            for (int i = 0; i < list.Count; i++)
            {
                option.ExcelPath = null;
                string path = list[i];
                if (File.Exists(path))
                {
                    option.ExcelPath = path;
                    try
                    {
                        Export(option);
                    }
                    catch (System.Exception e)
                    {
                        this.Invoke(putlog, string.Format("{0}:{1}", option.ExcelPath, e.Message));
                    }
                }
                this.Invoke(progress, (int)((i + 1) / (float)list.Count * 100));
            }
            this.Invoke(messagebox, "导出完成");
        }
Exemplo n.º 16
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            double progress = 0;

            ProgressBarDelegate updatePbDelegate = new ProgressBarDelegate(progressBar.SetValue);

            do
            {
                progress++;

                Dispatcher.Invoke(updatePbDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[]
                                  { ProgressBar.ValueProperty, progress });
                progressBar.Value = progress;
            }while (progressBar.Value != progressBar.Maximum);

            checkBox.IsEnabled = true;
        }
Exemplo n.º 17
0
        private void TFTP_OnTransfer(long BytesTransferred, long BytesTotal)
        {
            if (BytesTotal != 0)
            {
                ProgressBarDelegate progressBarDel = new ProgressBarDelegate(ProgressBarDelegateFunction);
                progressBar.Invoke(progressBarDel,
                                   new object[2] {
                    (int)(BytesTotal / 10), (int)(BytesTransferred / 10)
                });

                Console.Write("{0}/{1} Bytes Transferred\r", BytesTransferred, BytesTotal);
            }
            else
            {
                Console.Write(".");
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// 用委托去关闭跨线程窗体
 /// </summary>
 public static void CloseProgressBar()
 {
     if (waitingSplash == null)
     {
         return;
     }
     if (waitingSplash.InvokeRequired)
     {
         var pbd = new ProgressBarDelegate(CloseProgressBar);
         waitingSplash.Invoke(pbd);
     }
     else
     {
         waitingSplash.Close();
         bw.DoWork -= bw_DoWork;
     }
 }
        private void Progress()
        {
            this.pbProgress.Visibility = System.Windows.Visibility.Visible;
            double progress = 0;

            ProgressBarDelegate updatePbDelegate = new ProgressBarDelegate(pbProgress.SetValue);

            do
            {
                progress++;
                Dispatcher.Invoke(updatePbDelegate, DispatcherPriority.Background,
                    new object[] { ProgressBar.ValueProperty, progress });
                pbProgress.Value = progress;
                Task.Delay(100);
            }
            while (pbProgress.Value != pbProgress.Maximum);
            this.pbProgress.Visibility = System.Windows.Visibility.Collapsed;
        }
Exemplo n.º 20
0
        public void addToShortlist(int ID)
        {
            List <int> playersToLoad = new List <int>();

            playersToLoad.Add(ID);
            globalFuncs.scoutTimer.start();
            this.windowMain.CurrentGameDate.Text          = context.fm.MetaData.IngameDate.ToLongDateString();
            this.windowMain.vm.tabshortlist.TextBlockText = globalFuncs.localization.WindowMainLabels[3];
            setControlAvailability(false);
            this.vm.results.Text = "Importing...";

            LoadDelegate d = new LoadDelegate(this.loadShortlistPlayers);

            d.BeginInvoke(ref playersToLoad, null, null);
            ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar);

            p.BeginInvoke(null, null);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            backgroundWorker.DoWork += TareasBackGruondWorker;
            _guardarVideoBackgroundWorker.DoWork += GuardarVideoAsync;
            snackBarDelegate       = new SnackBarDelegate(EstadoSnackBar);
            progressBarDelegate    = new ProgressBarDelegate(EstadoProgressBar);
            siBtnDelegate          = new SiBtnDelegate(EstadoSi);
            noBtnDelegate          = new NoBtnDelegate(EstadoNo);
            preguntaLabelDelegate  = new PreguntaLabelDelegate(ContentPreguntaLabel);
            resultadoLabelDelegate = new ResultadoLabelDelegate(ContentResultadoLabel);
            ejercicioCardDelegate  = new EjercicioCardDelegate(EstadoEjercicioCard);
            desviosLabelDelegate   = new DesviosLabelDelegate(ContentDesviosLabel);
            fechaLabelDelegate     = new FechaLabelDelegate(FechaDesviosLabel);
            if (!backgroundWorker.IsBusy)
            {
                backgroundWorker.RunWorkerAsync();
            }

            ComentarioRepeticionTextBox.Focus();
        }
Exemplo n.º 22
0
 public void WorkWithProgressBar(ProgressBar Info, int action)
 {
     if (Info.InvokeRequired)
     {
         ProgressBarDelegate DDD = new ProgressBarDelegate(WorkWithProgressBar);
         Info.Invoke(DDD, new object[] { Info, action });
     }
     else
     {
         switch (action)
         {
             case 0:
                 progressBar1.Value = progressBar1.Minimum;
                 break;
             case 1:
                 if (progressBar1.Value != progressBar1.Maximum + 1)
                     progressBar1.Value++;
                 break;
             case 2:
                 progressBar1.Visible = false;
                 break;
             default:
                 break;
         }
     }
 }
Exemplo n.º 23
0
        public void loadShortlist()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Sports Interactive\\Football Manager 2011\\shortlists";
            openFileDialog.Multiselect      = true;
            openFileDialog.DefaultExt       = "slf";
            // The Filter property requires a search string after the pipe ( | )
            openFileDialog.Filter = "FM2011 Shortlists (*.slf)|*.slf";//|CSV Spreadsheet(*.csv)|*.csv";
            openFileDialog.ShowDialog();
            if (openFileDialog.FileNames.Length > 0)
            {
                string     ext           = openFileDialog.FileName.Substring(openFileDialog.FileName.LastIndexOf(".") + 1);
                List <int> playersToLoad = new List <int>();
                if (ext.Equals("slf"))
                {
                    int count = 0;
                    foreach (string filename in openFileDialog.FileNames)
                    {
                        ++count;
                        using (FileStream stream = new FileStream(filename, FileMode.Open))
                        {
                            byte[] header = new byte[14];
                            stream.Read(header, 0, header.Length);
                            byte[] shortlistNameLengthByte = new byte[4];
                            stream.Read(shortlistNameLengthByte, 0, shortlistNameLengthByte.Length);
                            int      shortlistNameLength = globalFuncs.ReadInt32(shortlistNameLengthByte);
                            byte[][] shortlistNameChar   = new byte[shortlistNameLength][];
                            for (int i = 0; i < shortlistNameLength; ++i)
                            {
                                shortlistNameChar[i] = new byte[2];
                                stream.Read(shortlistNameChar[i], 0, shortlistNameChar[i].Length);
                            }

                            byte[] bogusByte = new byte[2];
                            stream.Read(bogusByte, 0, bogusByte.Length);
                            int bogus = globalFuncs.ReadInt16(bogusByte);

                            byte[] noItemsByte = new byte[4];
                            stream.Read(noItemsByte, 0, noItemsByte.Length);
                            int noItems = globalFuncs.ReadInt32(noItemsByte);

                            byte[][] playersIDByte = new byte[noItems][];
                            for (int i = 0; i < noItems; ++i)
                            {
                                playersIDByte[i] = new byte[4];
                                stream.Read(playersIDByte[i], 0, playersIDByte[i].Length);
                                playersToLoad.Add(globalFuncs.ReadInt32(playersIDByte[i]));
                            }

                            byte[] endByte = new byte[4];
                            stream.Read(endByte, 0, 1);
                            int end = globalFuncs.ReadInt32(endByte);
                        }
                    }
                }
                else if (ext.Equals("csv"))
                {
                    int    count     = 0;
                    string separator = ",";
                    if (ext.Equals("txt"))
                    {
                        separator = " ";
                    }
                    foreach (string filename in openFileDialog.FileNames)
                    {
                        ++count;
                        using (FileStream stream = new FileStream(filename, FileMode.Open))
                        {
                            using (StreamReader sw = new StreamReader(stream))
                            {
                                string     columnLine = sw.ReadLine();
                                List <int> players    = new List <int>();

                                while (!sw.EndOfStream)
                                {
                                    string token = sw.ReadLine();
                                    string t     = token;
                                    token = token.Substring(0, token.IndexOf(separator));
                                    char[] rem = { '"', ',', '\\' };
                                    token = token.TrimStart(rem);
                                    token = token.TrimEnd(rem);
                                    playersToLoad.Add(Int32.Parse(token));
                                }
                            }
                        }
                    }
                }

                if (playersToLoad.Count > 0)
                {
                    globalFuncs.scoutTimer.start();
                    this.windowMain.CurrentGameDate.Text          = context.fm.MetaData.IngameDate.ToLongDateString();
                    this.windowMain.vm.tabshortlist.TextBlockText = globalFuncs.localization.WindowMainLabels[3];
                    setControlAvailability(false);
                    this.vm.results.Text = "Importing...";

                    LoadDelegate d = new LoadDelegate(this.loadShortlistPlayers);
                    d.BeginInvoke(ref playersToLoad, null, null);
                    ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar);
                    p.BeginInvoke(null, null);
                }
            }
        }