Update() private method

private Update ( ) : void
return void
Exemplo n.º 1
0
    public static ProgressBar CreateProgressBar(KMonoBehaviour entity, Func <float> updateFunc)
    {
        ProgressBar progressBar = Util.KInstantiateUI <ProgressBar>(ProgressBarsConfig.Instance.progressBarPrefab, null, false);

        progressBar.SetUpdateFunc(updateFunc);
        progressBar.transform.SetParent(GameScreenManager.Instance.worldSpaceCanvas.transform);
        progressBar.name = ((!((UnityEngine.Object)entity != (UnityEngine.Object)null)) ? string.Empty : (entity.name + "_")) + " ProgressBar";
        progressBar.transform.Find("Bar").GetComponent <Image>().color = ProgressBarsConfig.Instance.GetBarColor("ProgressBar");
        progressBar.Update();
        Vector3  a         = entity.transform.GetPosition() + Vector3.down * 0.5f;
        Building component = entity.GetComponent <Building>();

        TransformExtensions.SetPosition(position: (!((UnityEngine.Object)component != (UnityEngine.Object)null)) ? (a - Vector3.right * 0.5f) : (a - Vector3.right * 0.5f * (float)(component.Def.WidthInCells % 2) + component.Def.placementPivot), transform: progressBar.transform);
        return(progressBar);
    }
Exemplo n.º 2
0
        public void DownloadSelectedPhotos()
        {
            int    randNum;
            string fileName;
            string path;

            DialogResult folderBrowserDialogResult = FolderBrowserDialog.ShowDialog();

            if (folderBrowserDialogResult == System.Windows.Forms.DialogResult.OK)
            {
                IAggregate dataGridRowsAggregate = new DataGridRowsAggregate(PhotosDataGridView);
                IIterator  rowsDataGridIterator  = dataGridRowsAggregate.CreateIterator();

                if (!rowsDataGridIterator.IsDone)
                {
                    using (WebClient Client = new WebClient())
                    {
                        Random rnd = new Random();

                        path = FolderBrowserDialog.SelectedPath;
                        ProgressBar.Maximum = 0;

                        foreach (DataGridViewRow row in rowsDataGridIterator.NextItem)
                        {
                            bool isSelected = Convert.ToBoolean(row.Cells[0].Value);

                            if (isSelected)
                            {
                                randNum = rnd.Next(1, 1000);
                                ProgressBar.Maximum++;
                                Uri uri = new Uri(row.Cells[5].Value.ToString());
                                fileName = randNum + ".gif";
                                Client.DownloadFile(uri, path + "\\" + fileName);
                                ProgressBar.Value++;
                                ProgressBar.Update();
                            }
                        }
                    }
                }

                ProgressBar.Maximum = 1;
                MessageBox.Show("Download Completed!");
            }

            ProgressBar.Value = 0;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     //Update all of our UIComponents.
     YogUI.YogUI_Update(gameTime);
     textField.Update(gameTime);
     filterTextField.Update(gameTime);
     listBox.Update(gameTime);
     progressBar.Update(gameTime);
     sliderBar.Update(gameTime);
     radioButton1.Update(gameTime);
     radioButton2.Update(gameTime);
     checkBox.Update(gameTime);
     comboBox.Update(gameTime);
     button.Update(gameTime);
     button.SetText(textField.GetText());
     base.Update(gameTime);
 }
Exemplo n.º 4
0
        public void getRestaurants()
        {
            HtmlNode docNode        = getDocumentNode(URLPage1);
            int      NumRestaurants = getNumberofRestaurants(docNode);

            docNode = null;

            if (NumRestaurants > 0)
            {
                Console.WriteLine("Getting {0} Restaurants...", NumRestaurants);
                Restaurants = new List <Restaurant>(NumRestaurants);
                byte numPages = (byte)(NumRestaurants / RESTAURANTS_PER_PAGE);
                if ((NumRestaurants % RESTAURANTS_PER_PAGE) != 0)
                {
                    numPages = (byte)(numPages + 1);
                }

                ProgressBar pb = new ProgressBar(numPages);
                for (int pageCount = 0; pageCount < numPages; pageCount++)
                {
                    Console.Write(pb.Update(pageCount + 1));
                    var currentPage          = getDocumentNode(URLBase + @"?page=" + (pageCount + 1).ToString());
                    var allRestaurantsOnPage = currentPage.CssSelect("#search-results > article").ToArray();

                    byte onPage = (byte)allRestaurantsOnPage.Length;

                    Task[]            resTasks = new Task[onPage];
                    List <Restaurant> resOut   = new List <Restaurant>(onPage);
                    for (int currentRestaurantCounter = 0; currentRestaurantCounter < onPage; currentRestaurantCounter += 1)
                    {
                        var currentRestaurantNode = allRestaurantsOnPage[currentRestaurantCounter];
                        resTasks[currentRestaurantCounter] = Task.Factory.StartNew(() =>
                        {
                            Restaurant currentRestaurant = processRestaurant(currentRestaurantNode);
                            if (currentRestaurant != null)
                            {
                                resOut.Add(currentRestaurant);
                            }
                        });
                    }
                    Task.WaitAll(resTasks);

                    Restaurants.AddRange(resOut);
                }
            }
        }
Exemplo n.º 5
0
    public void LateUpdate()
    {
        float num;

        if (Operations.Update(out num))
        {
            if (!this.progressBar.IsVisible)
            {
                this.progressBar.Show();
            }
            this.progressIndicator.FillAmount = num;
        }
        else if (this.progressBar.IsVisible)
        {
            this.progressBar.Hide();
        }
    }
Exemplo n.º 6
0
        void UpdateProgressBar(ProgressBar pBar, int maxValue, int value)
        {
            if (pBar.InvokeRequired)
            {
                pBar.BeginInvoke(new Action <ProgressBar, int, int>(UpdateProgressBar), pBar, maxValue, value);
            }
            else
            {
                pBar.Maximum = maxValue;
                pBar.Minimum = 0;
                pBar.Value   = value;
                pBar.Update();
                pBar.Parent.Update();

                string pervalue = string.Format("{0} file(s) processed out of {1}", value, maxValue);
                UpdateLabelStatus(lblProgress, pervalue.ToString());
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Used to circumvent the animations used on progress bars in Windows 7 and up.
 /// Includes a Update() call to take care of redraw.
 /// </summary>
 /// <param name="pb">The progress bar to be updated</param>
 /// <param name="value">Value from 0 to 100 for the progress bar</param>
 public static void SetProgressNoAnimation(ProgressBar pb, int value)
 {
     // To get around the progressive animation, we need to move the
     // progress bar backwards.
     if (value == pb.Maximum)
     {
         // Special case as value can't be set greater than Maximum.
         pb.Maximum = value + 1;     // Temporarily Increase Maximum
         pb.Value   = value + 1;     // Move past
         pb.Maximum = value;         // Reset maximum
     }
     else
     {
         pb.Value = value + 1;       // Move past
     }
     pb.Value = value;               // Move to correct value
     pb.Update();
 }
Exemplo n.º 8
0
        private void SetClipingProgressValue(int value)
        {
            int kbValue = (value >> 10); // キロバイト単位に変換

            progress2Label.Text = kbValue.ToString() + " KB";
            if (progress2ProgressBar.Maximum > 0)
            {
                progress2Label.Text += " / " + progress2Maximum.ToString() + " KB";
                if (progress2ProgressBar.Maximum >= kbValue)
                {
                    progress2ProgressBar.Value = kbValue;
                }
            }

            // 強制的に再描画
            progress2Label.Update();
            progress2ProgressBar.Update();
        }
Exemplo n.º 9
0
        public Frame Trace()
        {
            var progressBar = new ProgressBar();

            ProgressStream.Subscribe(progress => progressBar.Update(progress * 100 / _totalProgress),
                                     () => progressBar.Complete());

            var clock = new Stopwatch();

            clock.Start();
            var frame = _tracer.Trace();

            clock.Stop();

            Console.WriteLine("Frame finished!");
            Console.WriteLine($"Elapsed time: {clock.Elapsed}.");
            return(frame);
        }
Exemplo n.º 10
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            FB2DescriptionCorrector fB2Corrector = null;

            foreach (FB2ItemInfo Info in m_LangFB2InfoList)
            {
                FictionBook fb2 = Info.FictionBook;
                if (fb2 != null)
                {
                    fB2Corrector = new FB2DescriptionCorrector(fb2);
                    fB2Corrector.recoveryDescriptionNode();

                    XmlNode xmlTI = fb2.getTitleInfoNode(TitleInfoEnum.TitleInfo);
                    if (xmlTI != null)
                    {
                        xmlTI.ReplaceChild(
                            fB2Corrector.makeLangNode(LangComboBox.Text.Substring(LangComboBox.Text.IndexOf('(') + 1, 2)),
                            fb2.getLangNode(TitleInfoEnum.TitleInfo)
                            );

                        // сохранение fb2 файла
                        if (!Directory.Exists(m_TempDir))
                        {
                            Directory.CreateDirectory(m_TempDir);
                        }
                        string NewPath = Info.IsFromZip ? Info.FilePathIfFromZip : Info.FilePathSource;
                        fb2.saveToFB2File(NewPath, false);
                        if (Info.IsFromZip)
                        {
                            WorksWithBooks.zipMoveTempFB2FileTo(m_sharpZipLib, NewPath, Info.FilePathSource);
                        }
                        if (Info.IsFromZip && File.Exists(NewPath))
                        {
                            File.Delete(NewPath);
                        }
                    }
                }
                m_bw.ReportProgress(1);
                ProgressBar.Update();
            }
            Cursor.Current = Cursors.Default;
        }
        private long ComputeFolderSpace(string[] files)
        {
            pbFileProgress.Maximum = files.Length;
            pbFileProgress.Step    = 1;
            long lngSpace = 0;

            Delimon.Win32.IO.FileInfo oFileInfo;
            int i = 1;

            foreach (var file in files)
            {
                this.lblProgress.Text = "Calculation file size: " + file;
                this.lblProgress.Update();
                oFileInfo            = new Delimon.Win32.IO.FileInfo(file);
                lngSpace            += oFileInfo.Length;
                pbFileProgress.Value = i++;
                pbFileProgress.Update();
            }
            return(lngSpace);
        }
Exemplo n.º 12
0
        public void update_rate_and_progress(int r, int cp, int np, int tr, int ts)
        {
            Restartbtn.Hide();
            int pv = (int)(Decimal.Divide(tr, ts) * 100);

            ProgressBar.Value = pv;
            ProgressBar.Update();

            label_downloaded.Text = Utils.Helpers.file_size(tr) + "/ " + Utils.Helpers.file_size(ts) + " (" + (Decimal.Divide(tr, ts) * 100).ToString("#") + "%)";

            //------------------------
            rec += r;
            int et = sw.ElapsedMilliseconds > 1 ? (int)sw.ElapsedMilliseconds : 1;
            int v  = 1000 * rec / et;

            label_rate.Text = Utils.Helpers.file_size(v) + "/s";
            sw.Reset();
            sw.Stop();
            sw.Start();
            rec = 0;
        }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the entity
 /// </summary>
 public void Update(GameTime gameTime)
 {
     if (Position.Equals(lastPos) && sprite.State != SpriteState.Attack && sprite.State != SpriteState.Die)
     {
         sprite.State = SpriteState.Idle;
     }
     lastPos = new Vector2(Position.X, Position.Y);
     sprite.Update(gameTime);
     if (healthBar != null)
     {
         healthBar.Update(gameTime);
     }
     if (CurrentHealth < MaxHealth)
     {
         CurrentHealth += regenRate;
     }
     else if (CurrentHealth > MaxHealth)
     {
         CurrentHealth = MaxHealth;
     }
 }
Exemplo n.º 14
0
        public void getRestaurants()
        {
            HtmlNode docNode = getDocumentNode(URLPage1);
            int NumRestaurants = getNumberofRestaurants(docNode);
            docNode = null;

            if (NumRestaurants > 0)
            {
                Console.WriteLine("Getting {0} Restaurants...", NumRestaurants);
                Restaurants = new List<Restaurant>(NumRestaurants);
                byte numPages = (byte)(NumRestaurants / RESTAURANTS_PER_PAGE);
                if ((NumRestaurants % RESTAURANTS_PER_PAGE) != 0) numPages = (byte)(numPages + 1);

                ProgressBar pb = new ProgressBar(numPages);
                for (int pageCount = 0; pageCount < numPages; pageCount++)
                {
                    Console.Write(pb.Update(pageCount+1));
                    var currentPage = getDocumentNode(URLBase + @"?page=" + (pageCount + 1).ToString());
                    var allRestaurantsOnPage = currentPage.CssSelect("#search-results > article").ToArray();

                    byte onPage = (byte)allRestaurantsOnPage.Length;

                    Task[] resTasks = new Task[onPage];
                    List<Restaurant> resOut = new List<Restaurant>(onPage);
                    for (int currentRestaurantCounter = 0; currentRestaurantCounter < onPage; currentRestaurantCounter += 1)
                    {
                        var currentRestaurantNode = allRestaurantsOnPage[currentRestaurantCounter];
                        resTasks[currentRestaurantCounter] = Task.Factory.StartNew(() =>
                        {
                            Restaurant currentRestaurant = processRestaurant(currentRestaurantNode);
                            if (currentRestaurant != null) { resOut.Add(currentRestaurant); }
                        });
                    }
                    Task.WaitAll(resTasks);

                    Restaurants.AddRange(resOut);
                }
            }
        }
 private void CreateProgressBar()
 {
     if (!((UnityEngine.Object)progressBar != (UnityEngine.Object)null))
     {
         progressBar = Util.KInstantiateUI <ProgressBar>(ProgressBarsConfig.Instance.progressBarPrefab, null, false);
         progressBar.transform.SetParent(GameScreenManager.Instance.worldSpaceCanvas.transform);
         progressBar.name = base.smi.master.name + "." + base.smi.master.GetType().Name + " ProgressBar";
         progressBar.transform.Find("Bar").GetComponent <Image>().color = ProgressBarsConfig.Instance.GetBarColor("ProgressBar");
         progressBar.SetUpdateFunc(HealthPercent);
         progressBar.barColor = ProgressBarsConfig.Instance.GetBarColor("HealthBar");
         CanvasGroup component = progressBar.GetComponent <CanvasGroup>();
         component.interactable   = false;
         component.blocksRaycasts = false;
         progressBar.Update();
         float   d      = 0.15f;
         Vector3 vector = base.gameObject.transform.GetPosition() + Vector3.down * d;
         vector.z += 0.05f;
         Rotatable component2 = GetComponent <Rotatable>();
         vector = ((!((UnityEngine.Object)component2 == (UnityEngine.Object)null) && component2.GetOrientation() != 0 && base.smi.master.building.Def.WidthInCells >= 2 && base.smi.master.building.Def.HeightInCells >= 2) ? (vector + Vector3.left * (1f + 0.5f * (float)(base.smi.master.building.Def.WidthInCells % 2))) : (vector - Vector3.right * 0.5f * (float)(base.smi.master.building.Def.WidthInCells % 2)));
         progressBar.transform.SetPosition(vector);
         progressBar.gameObject.SetActive(true);
     }
 }
Exemplo n.º 16
0
        protected override void AddEntries(
            Regex regex, string name, ProgressBar progressBar)
        {
            progressBar.Maximum = myBank.EntryCount;

            for (int i = 0; i < myBank.EntryCount; ++i)
            {
                AssetEntry entry = myBank.get_Entries(i);

                try
                {
                    if (regex != null &&
                        (regex.IsMatch(entry.DevSymbolName) ||
                         regex.IsMatch(entry.ID.ToString())))
                    {
                        AddEntry(
                            entry.DevSymbolName,
                            "",
                            entry);
                    }
                    else if (name == entry.DevSymbolName ||
                             name == entry.ID.ToString())
                    {
                        AddEntry(
                            entry.DevSymbolName,
                            "",
                            entry);
                    }
                }
                catch (Exception)
                {
                }

                progressBar.Value = i;
                progressBar.Update();
            }
        }
Exemplo n.º 17
0
 public void Update()
 {
     pbar.Update();
 }
Exemplo n.º 18
0
 public void SetPercentage(int p)
 {
     pb_percentage.Value = p;
     pb_percentage.Update();
 }
Exemplo n.º 19
0
 void vec_Progress(object sender, long percent, string jobDescription)
 {
     progressBar1.Value = (int)percent;
     progressBar1.Update();
 }
Exemplo n.º 20
0
 public void __showProgressTotal(Object get)
 {
     mProgressBarTotal.Value = (int)get;
     mProgressBarTotal.Update();
 }
Exemplo n.º 21
0
 public void performStep(ProgressBar bar)
 {
     if(bar.InvokeRequired) {
             bar.BeginInvoke(new performStepDelegate(performStep), new Object[] { bar });
         } else {
             lock(bar) {
                 bar.Increment(1);
                 bar.Update();
             }
         }
 }
Exemplo n.º 22
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            FB2DescriptionCorrector fB2Corrector = null;

            foreach (FB2ItemInfo Info in m_AuthorFB2InfoList)
            {
                FictionBook fb2 = Info.FictionBook;
                if (fb2 != null)
                {
                    // восстанавление раздела description до структуры с необходимыми элементами для валидности
                    fB2Corrector = new FB2DescriptionCorrector(fb2);
                    fB2Corrector.recoveryDescriptionNode();

                    IList <XmlNode> xmlNewAuthors = makeAuthorNode(Enums.AuthorEnum.AuthorOfBook, ref fb2, AuthorsListView);
                    if (xmlNewAuthors != null)
                    {
                        XmlNodeList xmlAuthorList = fb2.getAuthorNodes(TitleInfoEnum.TitleInfo);
                        if (xmlAuthorList != null)
                        {
                            XmlNode xmlBookTitleNode = fb2.getBookTitleNode(TitleInfoEnum.TitleInfo);
                            if (xmlBookTitleNode != null)
                            {
                                XmlNode xmlTINode = fb2.getTitleInfoNode(TitleInfoEnum.TitleInfo);
                                if (xmlTINode != null)
                                {
                                    // удаление старых данных Авторов
                                    foreach (XmlNode Author in xmlAuthorList)
                                    {
                                        xmlTINode.RemoveChild(Author);
                                    }
                                    // добавление новых данных Авторов
                                    foreach (XmlNode Author in xmlNewAuthors)
                                    {
                                        xmlTINode.InsertBefore(Author, xmlBookTitleNode);
                                    }

                                    // сохранение fb2 файла
                                    if (!Directory.Exists(m_TempDir))
                                    {
                                        Directory.CreateDirectory(m_TempDir);
                                    }
                                    string NewPath = Info.IsFromZip ? Info.FilePathIfFromZip : Info.FilePathSource;
                                    fb2.saveToFB2File(NewPath, false);
                                    if (Info.IsFromZip)
                                    {
                                        WorksWithBooks.zipMoveTempFB2FileTo(m_sharpZipLib, NewPath, Info.FilePathSource);
                                    }
                                    if (Info.IsFromZip && File.Exists(NewPath))
                                    {
                                        File.Delete(NewPath);
                                    }
                                }
                            }
                        }
                    }
                }
                m_bw.ReportProgress(1);
                ProgressBar.Update();
            }
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 23
0
        /// <summary>
        /// Function to transmit the application code via the SLT, which is now
        /// running on the device.  This code is specific to the supplied SLT.
        /// If the the TI supplied SLT is modified or a different boot loader is
        /// used, this code will need to be modified.
        /// </summary>
        private static Boolean TransmitImage(Byte[] imageData, UARTBOOT_Header ackHeader)
        {
            ProgressBar progressBar;
            UInt32      blockCnt;

            try
            {
                Console.WriteLine("Waiting for SENDIMG sequence...");
                if (!SerialIO.waitForSequence("SENDIMG\0", "BOOTUBL\0", MySP, cmdParams.verbose))
                {
                    return(false);
                }

                Console.WriteLine("SENDIMG received. Returning ACK and header for image data...");

                // Output 36 Bytes for the ACK sequence and header
                // 8 bytes acknowledge sequence = "    ACK\0"
                MySP.Write("    ACK\0");
                // 8 bytes of binary execution address = ASCII string of 8 hex characters
                MySP.Write(String.Format("{0:X8}", ackHeader.startAddr));
                // 8 bytes of data size = ASCII string of 8 hex characters
                MySP.Write(String.Format("{0:X8}", ackHeader.byteCnt));
                // 8 bytes of binary load address = ASCII string of 8 hex characters
                MySP.Write(String.Format("{0:X8}", ackHeader.loadAddr));
                // 4 bytes of constant zeros = "0000"
                MySP.Write("0000");

                Console.WriteLine("ACK command sent. Waiting for BEGIN command... ");

                // Wait for the ^^BEGIN\0 sequence
                if (!SerialIO.waitForSequence("  BEGIN\0", "BOOTUBL\0", MySP, cmdParams.verbose))
                {
                    return(false);
                }

                Console.WriteLine("BEGIN commmand received.");

                // Send the image data
                progressBar = new ProgressBar();
                progressBar.Update(0.0, "Sending Image data...");
                blockCnt = ackHeader.byteCnt / 128;
                for (int i = 0; i < (blockCnt * 128); i += 128)
                {
                    MySP.Write(imageData, i, 128);
                    progressBar.Percent = (((Double)(i + 1)) / ackHeader.byteCnt);
                }
                // Write last (possibly partial) block
                MySP.Write(imageData, (Int32)(blockCnt * 128), (Int32)(ackHeader.byteCnt - (blockCnt * 128)));
                progressBar.Update(100.0, "Image data sent.");

                Console.WriteLine("Waiting for DONE...");

                // Wait for first ^^^DONE\0 to indicate data received
                if (!SerialIO.waitForSequence("   DONE\0", "BOOTUBL\0", MySP, cmdParams.verbose))
                {
                    return(false);
                }

                Console.WriteLine("DONE received.  All bytes of image data received...");
            }
            catch (ObjectDisposedException e)
            {
                Console.WriteLine(e.StackTrace);
                throw e;
            }
            return(true);
        }
Exemplo n.º 24
0
 public void setProgressBarValue(ProgressBar bar, int new_value)
 {
     if(bar.InvokeRequired) {
             bar.BeginInvoke(new setProgressBarValueDelegate(setProgressBarValue),new Object[] {bar,new_value});
         } else {
             lock(bar) {
                 if(new_value>bar.Maximum)
                     bar.Value = bar.Maximum;
                 else if(new_value<bar.Minimum)
                     bar.Value = bar.Minimum;
                 else
                     bar.Value = new_value;
                 bar.Update();
             }
         }
 }
Exemplo n.º 25
0
        public void getReviews()
        {
            int NumReviews;
            if (int.TryParse(NumberOfReviews, out NumReviews) == false) NumReviews = -1;

            if (NumReviews > 0)
            {
                HtmlNode docNode = getDocumentNode(reviewsURL + @"?reviewsPage=1");
                var AddressNodes = docNode.CssSelect(".address > a > span").ToArray();
                docNode = null;

                Address = AddressNodes[1].InnerText.Trim();
                Address = Address.Replace("  ", " ");
                Address = Address.Replace(Environment.NewLine, "");

                Console.WriteLine("Getting {0} Reviews...", NumReviews);
                Reviews = new List<Review>(NumReviews);
                byte numPages = (byte)(NumReviews / REVIEWS_PER_PAGE);
                if ((NumReviews % REVIEWS_PER_PAGE) != 0) numPages = (byte)(numPages + 1);

                ProgressBar pb = new ProgressBar(numPages);
                for (int pageCount = 0; pageCount < numPages; pageCount++)
                {
                    Console.Write(pb.Update(pageCount + 1));
                    var currentPage = getDocumentNode(reviewsURL + @"?reviewsPage=" + (pageCount + 1).ToString());
                    var allReviewsOnPage = currentPage.CssSelect("#diner-reviews-list > article[itemProp='review']").ToArray();

                    byte onPage = (byte)allReviewsOnPage.Length;

                    Task[] revTasks = new Task[onPage];
                    List<Review> revOut = new List<Review>(onPage);
                    for (int currentReviewCounter = 0; currentReviewCounter < onPage; currentReviewCounter += 1)
                    {
                        var currentReviewNode = allReviewsOnPage[currentReviewCounter];
                        string reviewNumber = new string('0', NumberOfReviews.Length);
                        reviewNumber = reviewNumber + ((pageCount * REVIEWS_PER_PAGE) + currentReviewCounter).ToString();
                        reviewNumber = reviewNumber.Substring(reviewNumber.Length - NumberOfReviews.Length);

                        revTasks[currentReviewCounter] = Task.Factory.StartNew(() =>
                        {
                            Review currentReview = processReview(currentReviewNode, reviewNumber);
                            if (currentReview != null) { revOut.Add(currentReview); }
                        });
                    }
                    Task.WaitAll(revTasks);

                    Reviews.AddRange(revOut);
                }
            }
        }
Exemplo n.º 26
0
        public void executa()
        {
            int count = 0;

            DataSet dsExtension = new DataSet();

            NpgsqlCommand cmdsql = new NpgsqlCommand("", ds.DsCps);

            prgdlg.Visible = true;
            prgdlg.Value   = 0;
            prgdlg.Maximum = aSql.Count() + aLegenda.Count() + aView.Count() + aFuncao.Count() + aTrigger.Count();



            cmdsql.CommandText = cSqlViewApagar.ToString();
            cmdsql.ExecuteNonQuery();

            cmdsql.CommandText = cSqlTriggerApagar.ToString();
            cmdsql.ExecuteNonQuery();

            cLabelTela.Text = "executando as modificações no banco de dados...";
            cLabelTela.Update();
            foreach (var element in aSql)
            {
                count++;
                prgdlg.Value = count;

                prgdlg.Update();

                cmdsql.CommandText = element.ToString();
                cmdsql.ExecuteNonQuery();
            }
            cLabelTela.Text = "executando os comentários no banco de dados...";

            foreach (var element in aLegenda)
            {
                count++;
                prgdlg.Value = count;
                prgdlg.Update();
                cmdsql.CommandText = element.ToString();
                cmdsql.ExecuteNonQuery();
            }

            cLabelTela.Text = "atualizando as views no banco de dados...";

            foreach (var element in aView)
            {
                count++;
                prgdlg.Value = count;
                prgdlg.Update();
                cmdsql.CommandText = element.ToString();
                cmdsql.ExecuteNonQuery();
            }

            cLabelTela.Text = "atualizando as funções no banco de dados...";

            foreach (var element in aFuncao)
            {
                count++;
                prgdlg.Value = count;
                prgdlg.Update();
                cmdsql.CommandText = element.ToString();
                cmdsql.ExecuteNonQuery();
            }

            cLabelTela.Text = "atualizando as triggers no banco de dados...";

            foreach (var element in aTrigger)
            {
                count++;
                prgdlg.Value = count;
                prgdlg.Update();
                cmdsql.CommandText = element.ToString();
                cmdsql.ExecuteNonQuery();
            }

            cmdsql.Dispose();
        }
Exemplo n.º 27
0
        // Обработка файлов
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            m_dtStart = DateTime.Now;
            FB2Validator fv2Validator = new FB2Validator();

            m_listView.BeginUpdate();
            if (m_booksValidateMode == BooksValidateModeEnum.CheckedBooks)
            {
                // для помеченных книг
                ListView.CheckedListViewItemCollection checkedItems = m_listView.CheckedItems;
                if (checkedItems.Count > 0)
                {
                    this.Text          += ": Помеченные книги";
                    ProgressBar.Maximum = checkedItems.Count;
                    ProgressBar.Value   = 0;
                    int i = 0;
                    foreach (ListViewItem lvi in checkedItems)
                    {
                        if ((m_bw.CancellationPending))
                        {
                            m_listView.EndUpdate();
                            e.Cancel = true;
                            return;
                        }
                        validateFile(lvi, ref fv2Validator);
                        m_bw.ReportProgress(++i);
                        ProgressBar.Update();
                    }
                }
            }
            else if (m_booksValidateMode == BooksValidateModeEnum.SelectedBooks)
            {
                // для выделенных книг
                ListView.SelectedListViewItemCollection selItems = m_listView.SelectedItems;
                this.Text += ": Выделенные книги";
                if (selItems.Count > 0)
                {
                    // группа для выделенной книги
                    ProgressBar.Maximum = selItems.Count;
                    ProgressBar.Value   = 0;
                    int i = 0;
                    foreach (ListViewItem lvi in selItems)
                    {
                        if ((m_bw.CancellationPending))
                        {
                            m_listView.EndUpdate();
                            e.Cancel = true;
                            return;
                        }
                        validateFile(lvi, ref fv2Validator);
                        m_bw.ReportProgress(++i);
                        ProgressBar.Update();
                    }
                }
            }
            else
            {
                // для всех книг
                this.Text += ": Выделенные книги";
                ListView.ListViewItemCollection lvItemColl = m_listView.Items;
                if (lvItemColl.Count > 0)
                {
                    // группа для выделенной книги
                    ProgressBar.Maximum = lvItemColl.Count;
                    ProgressBar.Value   = 0;
                    int i = 0;
                    foreach (ListViewItem lvi in lvItemColl)
                    {
                        if ((m_bw.CancellationPending))
                        {
                            m_listView.EndUpdate();
                            e.Cancel = true;
                            return;
                        }
                        validateFile(lvi, ref fv2Validator);
                        m_bw.ReportProgress(++i);
                        ProgressBar.Update();
                    }
                }
            }
            m_listView.EndUpdate();
        }
Exemplo n.º 28
0
        private void UpdateProgressBar(Int64 bytes
                                       , DateTime start)
        {
            if (bytes == -1)
            {
                if (TaskbarManager.IsPlatformSupported)
                {
                    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
                }

                ProgressBar.Value = ProgressBar.Maximum;

                RemaingLabel.Text = ".....";
            }
            else
            {
                DateTime now = DateTime.Now;

                Int32 value = (Int32)(bytes / m_Divider);

                if (TaskbarManager.IsPlatformSupported)
                {
                    TaskbarManager.Instance.SetProgressValue(value, ProgressBar.Maximum);
                }

                ProgressBar.Value = value;

                if (ProgressBar.Value != 0)
                {
                    TimeSpan span = now.Subtract(start);

                    Decimal completeTimeTicks = (Decimal)(ProgressBar.Maximum) / ProgressBar.Value * span.Ticks;

                    TimeSpan remainingTime = new TimeSpan(Convert.ToInt64(completeTimeTicks) - span.Ticks);

                    Decimal speed = bytes * 1000m / (Decimal)(span.TotalMilliseconds);

                    String speedText = " (" + FormatBytes(Convert.ToInt64(speed)) + "/s)";

                    if (remainingTime.Hours > 0)
                    {
                        Int32 minutes = remainingTime.Minutes;

                        if (remainingTime.Seconds > 30)
                        {
                            minutes++;
                        }

                        RemaingLabel.Text = "est. " + remainingTime.Hours + " hours, " + minutes + " minutes remaining" + speedText;
                    }
                    else if (remainingTime.Minutes > 0)
                    {
                        RemaingLabel.Text = "est. " + remainingTime.Minutes + " minutes, " + remainingTime.Seconds + " seconds remaining" + speedText;
                    }
                    else
                    {
                        RemaingLabel.Text = "est. " + remainingTime.Seconds + " seconds remaining" + speedText;
                    }
                }
            }

            ProgressBar.Update();
            ProgressBar.Refresh();
        }
Exemplo n.º 29
0
 public void setProgressBarStyle(ProgressBar bar, ProgressBarStyle new_style)
 {
     if(bar.InvokeRequired) {
             bar.Invoke(new setProgressBarStyleDelegate(setProgressBarStyle),new Object[] {bar,new_style});
         } else {
             lock(bar) {
                 bar.Style = new_style;
                 bar.Update();
             }
         }
 }
Exemplo n.º 30
0
        public FormMain()
        {
            Form progressBar = new ProgressBar();
            try
            {
                progressBar.StartPosition = FormStartPosition.CenterScreen;
                progressBar.Show();
                progressBar.Update();

                //
                // Required for Windows Form Designer support
                //
                InitializeComponent();

                //
                // TODO: Add any constructor code after InitializeComponent call
                //
                InitSessionContext();
                SetDefaultInputs();
                CustomInit();
                SetFormStartPosition();
                bindEvent();
                progressBar.Hide();
            }
            catch(Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                progressBar.Dispose();
            }
        }
Exemplo n.º 31
0
 public void setProgressBarMax(ProgressBar bar, int new_max)
 {
     if(bar.InvokeRequired) {
             bar.BeginInvoke(new setProgressBarMaxDelegate(setProgressBarMax),new Object[] {bar,new_max});
         } else {
             lock(bar) {
                 bar.Maximum = new_max;
                 bar.Update();
             }
         }
 }
Exemplo n.º 32
0
        /// <summary>
        /// Function to Transmit the UBL via the device ROM Serial boot
        /// </summary>
        private static void TransmitUBL(Byte[] imageData, UARTBOOT_Header ackHeader)
        {
            // Local Variables for building up output
            StringBuilder UBLsb;
            CRC32         MyCRC;
            ProgressBar   progressBar;
            Int32         blockCnt;

            UBLsb = new StringBuilder(imageData.Length * 2);

            // Read the data from the UBL file into the appropriate structures
            for (int i = 0; i < imageData.Length; i += sizeof(UInt32))
            {
                UBLsb.AppendFormat("{0:X8}", System.BitConverter.ToUInt32(imageData, i));
            }

            // Create CRC object and use it to calculate the UBL file's CRC
            // Note that this CRC is not quite the standard CRC-32 algorithm
            // commonly in use since the final register value is not XOR'd
            // with 0xFFFFFFFF.  As a result the CRC value returned here
            // will be the bitwise inverse of the standard CRC-32 value.
            MyCRC             = new CRC32(0x04C11DB7, 0xFFFFFFFF, 0x00000000, true, 1, CRCType.ONESHOT, CRCCalcMethod.LUT);
            ackHeader.crcVal  = MyCRC.CalculateCRC(imageData);
            ackHeader.byteCnt = (UInt32)imageData.Length;

            try
            {
BOOTMESEQ:
                Console.WriteLine("\nWaiting for the " + devString + "...");

                // Wait for the device to send the ^BOOTME/0 sequence
                if (SerialIO.waitForSequence(" BOOTME\0", " BOOTME\0", MySP, cmdParams.verbose))
                {
                    Console.WriteLine("BOOTME commmand received. Returning ACK and header...");
                }
                else
                {
                    goto BOOTMESEQ;
                }

                // Output 28 Bytes for the ACK sequence and header
                // 8 bytes acknowledge sequence = "    ACK\0"
#if (DM35x_REVB || DM36x_REVA)
                MySP.Write("    ACK");
#else
                MySP.Write("    ACK\0");
#endif
                // 8 bytes of CRC data = ASCII string of 8 hex characters
                MySP.Write(ackHeader.crcVal.ToString("X8"));

                // 4 bytes of UBL data size = ASCII string of 4 hex characters (3800h = 14336d)
                MySP.Write(ackHeader.byteCnt.ToString("X4"));

                // 4 bytes of start address = ASCII string of 4 hex characters (>=0100h)
                MySP.Write(ackHeader.startAddr.ToString("X4"));

                // 4 bytes of constant zeros = "0000"
                MySP.Write("0000");
                Console.WriteLine("ACK command sent. Waiting for BEGIN command... ");

                // Wait for the BEGIN sequence
                if (SerialIO.waitForSequence("  BEGIN\0", " BOOTME\0", MySP, true))
                {
                    Console.WriteLine("BEGIN commmand received. Sending CRC table...");
                }
                else
                {
                    goto BOOTMESEQ;
                }

                // Send the 1024 byte (256 word) CRC table
                progressBar = new ProgressBar();
                progressBar.Update(0.0, "Sending CRC table...");
                for (int i = 0; i < MyCRC.Length; i++)
                {
                    MySP.Write(MyCRC[i].ToString("x8"));
                    progressBar.Percent = (((Double)(i + 1)) / MyCRC.Length);
                }
                progressBar.Update(100.0, "CRC table sent.");
                Console.WriteLine("Waiting for DONE...");

                // Wait for the first DONE sequence
                if (SerialIO.waitForSequence("   DONE\0", " BOOTME\0", MySP, cmdParams.verbose))
                {
                    Console.WriteLine("DONE received.  Sending the UBL...");
                }
                else
                {
                    goto BOOTMESEQ;
                }

                // Send the contents of the UBL file (as hex text)
                progressBar = new ProgressBar();
                progressBar.Update(0.0, "Sending UBL...");
                blockCnt = UBLsb.Length / 128;
                for (int i = 0; i < (blockCnt * 128); i += 128)
                {
                    MySP.Write(UBLsb.ToString(i, 128));
                    progressBar.Percent = (((Double)(i + 1)) / UBLsb.Length);
                }
                // Write last (possibly partial) block
                MySP.Write(UBLsb.ToString(blockCnt * 128, UBLsb.Length - (blockCnt * 128)));
                progressBar.Update(100.0, "UBL sent.");

                // Wait for the second DONE sequence
                if (SerialIO.waitForSequence("   DONE\0", " BOOTME\0", MySP, cmdParams.verbose))
                {
                    Console.WriteLine("DONE received.  UBL was accepted.");
                }
                else
                {
                    goto BOOTMESEQ;
                }

                Console.WriteLine("UBL transmitted successfully.\n");
            }
            catch (ObjectDisposedException e)
            {
                Console.WriteLine(e.StackTrace);
                throw e;
            }
        }
Exemplo n.º 33
0
        // Обработка файлов
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            ProgressBar.Value = 0;
            int          i            = 0;
            FB2Validator fv2Validator = new FB2Validator();

            switch (m_WorkMode)
            {
            case BooksAutoCorrectModeEnum.SelectedBooks:
                this.Text = string.Format(
                    "Автокорректировка выделенных {0} книг", m_listViewFB2Files.SelectedItems.Count
                    );

                // при пакетной обработке (не прерывать обработку на вылете корректировки, а переходим к обработке следующей книги)
                BooksAutoCorrectProcessingModeEnum AutoCorrectProcessingMode =
                    (m_listViewFB2Files.SelectedItems.Count == 1)
                                                ? BooksAutoCorrectProcessingModeEnum.OneBookProcessing
                                                : BooksAutoCorrectProcessingModeEnum.BatchProcessing;
                foreach (ListViewItem SelectedItem in m_listViewFB2Files.SelectedItems)
                {
                    if ((m_bw.CancellationPending))
                    {
                        e.Cancel = true;
                        return;
                    }
                    // обработка файла
                    WorksWithBooks.autoCorrect(
                        AutoCorrectProcessingMode, SelectedItem, SelectedItem.Text, m_sharpZipLib, m_fv2Validator
                        );
                    m_bw.ReportProgress(++i);
                    ProgressBar.Update();
                }
                break;

            case BooksAutoCorrectModeEnum.CheckedBooks:
                this.Text = string.Format("Автокорректировка помеченных {0} книг", m_listViewFB2Files.CheckedItems.Count);
                // при пакетной обработке (не прерывать обработку на вылете корректировки, а переходим к обработке следующей книги)
                AutoCorrectProcessingMode = (m_listViewFB2Files.CheckedItems.Count == 1)
                                                ? BooksAutoCorrectProcessingModeEnum.OneBookProcessing
                                                : BooksAutoCorrectProcessingModeEnum.BatchProcessing;

                foreach (ListViewItem CheckedItem in m_listViewFB2Files.CheckedItems)
                {
                    if ((m_bw.CancellationPending))
                    {
                        e.Cancel = true;
                        return;
                    }
                    // обработка файла
                    WorksWithBooks.autoCorrect(
                        AutoCorrectProcessingMode, CheckedItem, CheckedItem.Text, m_sharpZipLib, m_fv2Validator
                        );
                    m_bw.ReportProgress(++i);
                }
                break;

            case BooksAutoCorrectModeEnum.BooksInGroup:
                this.Text = string.Format("Автокорректировка {0} книг в Группе", m_listViewFB2Files.SelectedItems[0].Group.Items.Count);
                foreach (ListViewItem Item in m_listViewFB2Files.SelectedItems[0].Group.Items)
                {
                    if ((m_bw.CancellationPending))
                    {
                        e.Cancel = true;
                        return;
                    }
                    // обработка файла
                    WorksWithBooks.autoCorrect(
                        BooksAutoCorrectProcessingModeEnum.BatchProcessing, Item, Item.Text, m_sharpZipLib, m_fv2Validator
                        );
                    m_bw.ReportProgress(++i);
                    ProgressBar.Update();
                }
                break;

            case BooksAutoCorrectModeEnum.BooksInAllGroup:
                this.Text = string.Format("Автокорректировка {0} книг во всех Группах", m_listViewFB2Files.Items.Count);
                foreach (ListViewItem Item in m_listViewFB2Files.Items)
                {
                    if ((m_bw.CancellationPending))
                    {
                        e.Cancel = true;
                        return;
                    }
                    // обработка файла
                    WorksWithBooks.autoCorrect(
                        BooksAutoCorrectProcessingModeEnum.BatchProcessing, Item, Item.Text, m_sharpZipLib, m_fv2Validator
                        );
                    m_bw.ReportProgress(++i);
                    ProgressBar.Update();
                }
                break;

            default:
                return;
            }

            if ((m_bw.CancellationPending))
            {
                e.Cancel = true;
                return;
            }
        }
Exemplo n.º 34
0
        protected override void Update(GameTime gameTime)
        {
            bomb.Update();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            x = random.Next(100, 400);
            y = random.Next(100, 300);

            /*
             * if((bomb.Position-spriteSheet.Position).Length() < 25)
             * {
             *  bomb.Position = new Vector2(random.Next(300, 600), random.Next(100,300));
             *
             * }
             */
            /*
             * if (( spriteSheet.Position– bomb.Position).Length() < 50)
             * {
             *  timeBar.Value += < some value >;
             *  bonus.Position = new Vector2(< provide random x, y >);
             * }
             */
            if ((spriteSheet.Position - bomb.Position).Length() < 70f)
            {
                if (timer.width < 128)
                {
                    timer.width += 128;
                }
                if (timer.width >= 128)
                {
                    timer.width = 256;
                }

                timer.Update();
                bomb.Position = new Vector2(x, y);
                bomb.Update();
            }
            //Console.WriteLine((spriteSheet.Position - bomb.Position).Length());
            //Console.WriteLine(Vector2.Distance(spriteSheet.Position, bomb.Position));
            //Console.WriteLine("Sheet" +spriteSheet.Position);
            //Console.WriteLine(timer.width);

            spriteSheet.Update();
            if (timer.width > 0)
            {
                timer.width -= 1;
            }


            //old movement controls
            InputManager.Update();

            /*
             * if (InputManager.IsKeyDown(Keys.Left))
             * {
             *  spriteSheet.Position += new Vector2(-4,0);
             *  spriteSheet.dir = 2;
             *  distance.width += 1;
             * }
             * if (InputManager.IsKeyDown(Keys.Right))
             * {
             *  spriteSheet.Position += new Vector2(4, 0);
             *  spriteSheet.dir = 3;
             *  distance.width += 1;
             * }
             * if (InputManager.IsKeyDown(Keys.Up))
             * {
             *  spriteSheet.Position += new Vector2(0, -4);
             *  spriteSheet.dir = 0;
             *  distance.width += 1;
             * }
             * if (InputManager.IsKeyDown(Keys.Down))
             * {
             *  spriteSheet.Position += new Vector2(0, 4);
             *  spriteSheet.dir = 1;
             *  distance.width += 1;
             * }
             */

            //updated movementcontrols using axis


            spriteSheet.Position += new Vector2((float)axis.x, (float)axis.y) * speed;



            if (InputManager.IsKeyDown(Keys.A))
            {
                spriteSheet.dir = 2;
                distance.width += 1;
            }
            if (InputManager.IsKeyDown(Keys.D))
            {
                spriteSheet.dir = 3;
                distance.width += 1;
            }
            if (InputManager.IsKeyDown(Keys.W))
            {
                spriteSheet.dir = 0;
                distance.width += 1;
            }
            if (InputManager.IsKeyDown(Keys.S))
            {
                spriteSheet.dir = 1;
                distance.width += 1;
            }
            if (axis.x < 0)
            {
                axis.x += (decimal)0.2;
            }
            if (axis.x > 0)
            {
                axis.x -= (decimal)0.2;
            }
            if (axis.y < 0)
            {
                axis.y += (decimal)0.2;
            }
            if (axis.y > 0)
            {
                axis.y -= (decimal)0.2;
            }



            Console.WriteLine(axis.y);
            Console.WriteLine(axis.x);
            axis.Update();

            if (timer.width == 0)
            {
                lose = true;
            }
            if (distance.width == 256)
            {
                win = true;
            }



            base.Update(gameTime);
        }
Exemplo n.º 35
0
 private void __showProgressCur(Object get)
 {
     mProgressBarCur.Value = (int)get;
     mProgressBarCur.Update();
 }
Exemplo n.º 36
0
 public void Update(float passedTime)
 {
     progressBar.Update(passedTime);
 }
Exemplo n.º 37
0
 public void setProgressBarMin(ProgressBar bar, int new_min)
 {
     if(bar.InvokeRequired) {
             bar.BeginInvoke(new setProgressBarMinDelegate(setProgressBarMin),new Object[] {bar,new_min});
         } else {
             lock(bar) {
                 bar.Minimum = new_min;
                 bar.Update();
             }
         }
 }
Exemplo n.º 38
0
        public static void CopyFolder(string folderId, string newFolderName, DriveService service)
        {
            // Create new folder
            Console.WriteLine("Copying Folder");
            File SkoleBackup;

            if (GetFiles(service, "title='" + newFolderName + "'").Count > -1)
            {
                // Skole-Backup doesn't exist we need to create it
                SkoleBackup = CreateDirectory(service, newFolderName, "0AMNEg58TrL9RUk9PVA");
            }
            else
            {
                // Skole-Backup does exist we need to create it
                SkoleBackup = GetFiles(service, "title='" + newFolderName + "'")[0];
            }

            // Copy folder structure
            Console.WriteLine("Finding All Folders");
            string StartDirectory   = folderId;
            string WorkingDirectory = SkoleBackup.Id;

            List <File> StartFolders;
            {
                // Find all folders
                List <File> nestedUnsearched = NestedFolders(service, folderId);
                List <File> nestedSearched   = new List <File>();
                do
                {
                    nestedSearched.Add(nestedUnsearched[0]);
                    nestedUnsearched.AddRange(NestedFolders(service, nestedUnsearched[0].Id));
                    nestedUnsearched.RemoveAt(0);
                } while (nestedUnsearched.Count > 0);
                nestedSearched.Remove(service.Files.Get(SkoleBackup.Id).Execute());
                StartFolders = nestedSearched;
            }
            Dictionary <string, string> MovedFiles = new Dictionary <string, string>();

            MovedFiles.Add(folderId, SkoleBackup.Id);
            List <File> WorkingNested = new List <File>();
            {
                Console.WriteLine("Creating Folders");
                do
                {
                    List <File> ToBeRemoved = new List <File>();
                    for (var i = 0; i < StartFolders.Count; i++)
                    {
                        //Console.WriteLine("Folder Found");
                        if (MovedFiles.ContainsKey(StartFolders[i].Parents[0].Id))
                        {
                            var newFolder = CreateDirectory(service, StartFolders[i].Title, MovedFiles[StartFolders[i].Parents[0].Id]);
                            MovedFiles.Add(StartFolders[i].Id, newFolder.Id);
                            ToBeRemoved.Add(StartFolders[i]);
                        }
                        Console.Write("\r{0}", i + 1);
                        Console.Write("/" + StartFolders.Count);
                    }
                    foreach (var file in ToBeRemoved)
                    {
                        StartFolders.Remove(file);
                    }
                } while (StartFolders.Count > 0);
                //This is to make sure next print isn't f****d
                Console.WriteLine("");
            }

            // Write copy all content and convert docs to pdf
            {
                int maxTicks = 0;

                foreach (var folder in MovedFiles)
                {
                    maxTicks += NumChildsInFolder(folder.Key, service);
                }

                Console.WriteLine("Copying Files");
                ProgressBar progress = new ProgressBar(maxTicks);
                int         ticks    = 0;

                foreach (var folder in MovedFiles)
                {
                    foreach (var file in AllChildsInFolder(folder.Key, service))
                    {
                        var fileInfo = CopyFileIntoFolder(file, folder.Value, service);
                        ClearCurrentConsoleLine();
                        string message = "Current File: " + fileInfo.Title + "(" + fileInfo.Id + ")";
                        Console.CursorLeft = 0;
                        Console.Write(message);
                        progress.Update(ticks);
                        ticks++;
                    }
                }
                progress.Complete();
            }
        }
Exemplo n.º 39
0
        static void MainTest()
        {
            UIScene currentElement;
            Table myElement, myOtherElement, ThirdElement;
            FW.Buffer buffer;
            ProgressBar pb;

            UIManager.Initialize(ConsoleColor.White);

            myElement = new Table(new string[][] {new string[] {
                "Left 1", "Right 1"},
                new string[] {"Left 2", "Right 2"},
                new string[] {"Left 3", "Right 3 Looong"},
                new string[] {"Left 444444554545454444", "t"},
                new string[] {"i", "asdasdasdasdasdasdasdasd"},
                new string[] {"Level", "9001"}}, 30, null, ConsoleColor.Red, TableMode.LeftHeader);

            myOtherElement = new Table(new string[][] { // So sieht der Quellcode aus
                new string[] {"This", "Here"},
                new string[] {"is", "be"},
                new string[] {"the", "data"},
                new string[] {"title", "00"},
                new string[] {"line", "000"},
                new string[] {"!", "0000"}}, 30, null, ConsoleColor.Red, TableMode.LeftHeader);

            ThirdElement = new Table(new string[][] {new string[] {
                "Name", "OP"},
                new string[] {"OP?", "OP"},
                new string[] {",,,,,,,,", "......"},
                new string[] {"       Needs trimming", "9002"},
                new string[] {"Intelligenz", "Really does                   "},
                new string[] {"Level", "Colorful console game thingy"}}, 61, null, ConsoleColor.Red, TableMode.TopHeader);

            pb = new ProgressBar(0, 61);

            currentElement = new UIScene(new IRenderable[] { myElement, myOtherElement, ThirdElement, pb },
                new int[][] { new int[] { 1, 1 }, new int[] { 1, 32 }, new int[] { 8, 1 }, new int[] { 15, 1 } },
                new string[] { "Spieler 1", "Spieler 2", "OMG Gegner", "Progress" }, 17, 63, ConsoleColor.Green, null);

            UIManager.setScene(currentElement);

            UIManager.Render();
            UIManager.DrawFrame();

            Console.ReadKey();

            pb.Update(0.5);
            UIManager.Render();
            UIManager.DrawFrame();
            Console.ReadKey();

            pb.Update(0.3);
            UIManager.Render();
            UIManager.DrawFrame();
            Console.ReadKey();

            pb.Update(1);
            UIManager.Render();
            UIManager.DrawFrame();
            Console.ReadKey();

            currentElement = new UIScene(new IRenderable[] { myOtherElement, myElement, ThirdElement },
                new int[][] { new int[] { 1, 1 }, new int[] { 1, 32 }, new int[] { 8, 1 } },
                new string[] { "Spieler 1", "Spieler 2", "OMG Gegner" }, 15, 63, ConsoleColor.Green, null);

            UIManager.setScene(currentElement);

            UIManager.Render();
            UIManager.DrawFrame();

            Console.ReadKey();

            buffer = new FW.Buffer(myElement, new FireworkEngine.Margin { Top = 3, Left = 6, Bottom = 3, Right = 7 }, ' ');
            currentElement = new UIScene(new[] { buffer }, new[] { new[] { 1, 1 } }, new[] { "Buffer Test" }, 14, 45);

            UIManager.setScene(currentElement);

            UIManager.Render();
            UIManager.DrawFrame();

            Console.ReadKey();
        }