Ejemplo n.º 1
0
    public void RefreshItem(Compra compra)
    {
        for (int i = 0; i < table.tableContent.Count; i++)
        {
            if (table.tableContent[i][1].Value == compra.Fornecedor && int.Parse(table.tableContent[i][5].Value) == compra.NotaFiscal)
            {
                List <Tabela3.TableItem> linha = new List <Tabela3.TableItem>();
                linha.Add(new Tabela3.TableItem(compra.Data));
                linha.Add(new Tabela3.TableItem(compra.Fornecedor));
                linha.Add(new Tabela3.TableItem(compra.Area.ToString()));
                linha.Add(new Tabela3.TableItem(Ultilities.Money(compra.Valor)));
                linha.Add(new Tabela3.TableItem(compra.Pagamento.ToString()));
                linha.Add(new Tabela3.TableItem(Ultilities.NF(compra.NotaFiscal)));
                linha.Add(new Tabela3.TableItem(compra.Banco.ToString()));
                linha.Add(new Tabela3.TableItem(compra.Obs));
                table.tableContent[i] = linha;


                float currentScroll = table.bar.value;
                table.Desenhar(table.tableContent);
                table.bar.value = currentScroll;
                table.OnScroll(table.bar.value);
                return;
            }
        }
    }
Ejemplo n.º 2
0
    public void RefreshTable()
    {
        //load a lista de compras
        List <Compra> compras = StorageManager.Compras();

        //prepara o conteudo da tabela
        List <List <Tabela3.TableItem> > tableContent = new List <List <Tabela3.TableItem> >();

        //adiciona os outros valores
        foreach (Compra compra in compras)
        {
            List <Tabela3.TableItem> linha = new List <Tabela3.TableItem>();
            linha.Add(new Tabela3.TableItem(compra.Data));
            linha.Add(new Tabela3.TableItem(compra.Fornecedor));
            linha.Add(new Tabela3.TableItem(compra.Area.ToString()));
            linha.Add(new Tabela3.TableItem(Ultilities.Money(compra.Valor)));
            linha.Add(new Tabela3.TableItem(compra.Pagamento.ToString()));
            linha.Add(new Tabela3.TableItem(Ultilities.NF(compra.NotaFiscal)));
            linha.Add(new Tabela3.TableItem(compra.Banco.ToString()));
            linha.Add(new Tabela3.TableItem(compra.Obs));

            tableContent.Add(linha);
        }
        table.Desenhar(tableContent);
    }
        private void btnCheckConn_Click(object sender, EventArgs e)
        {
            if (tbServerName.Text.Trim().Equals(""))
            {
                MessageBox.Show("Vui lòng nhập tên server!", "Nhắc nhở", MessageBoxButtons.OK);
                return;
            }

            string tempConnStr = "Data Source=" + tbServerName.Text.Trim() + ";Initial Catalog=BM;Integrated Security=True";

            if (!ssmWaiting.IsSplashFormVisible)
            {
                ssmWaiting.ShowWaitForm();
            }

            if (Ultilities.IsValidConnection(tempConnStr))
            {
                btnOk.Enabled = true;
                ssmWaiting.CloseWaitForm();
                MessageBox.Show("Kiểm tra kết nối thành công!", "Thành công", MessageBoxButtons.OK);
            }
            else
            {
                ssmWaiting.CloseWaitForm();
                MessageBox.Show("Không tìm thấy server!", "Lỗi", MessageBoxButtons.OK);
                return;
            }
        }
 private void btnOk_Click(object sender, EventArgs e)
 {
     Ultilities.SaveConnectionInformation(tbServerName.Text.Trim());
     MessageBox.Show("Cấu hình cơ sở dữ liệu thành công!\nChương trình sẽ được khởi động lại!", "Thông báo", MessageBoxButtons.OK);
     this.DialogResult = DialogResult.OK;
     Application.Restart();
 }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (!EscPressed && Input.GetKeyUp(KeyCode.Escape))
        {
            string currentLevelName = Application.loadedLevelName;

            if (currentLevelName.Contains(CHANGJING) || currentLevelName.Contains(WUJIN))
            {
                Time.timeScale          = 0;
                GameData.Instance.Pause = true;
//				DialogManager.Instance.PopupDialog(CommonAsset.Load("prefabs/Dialogs/PauseGameDialog"));
                PauseGameDialog.Popup();
            }
            else if (currentLevelName.Contains(UI))
            {
                Ultilities.CleanMemory();
                Application.LoadLevel("login");
            }
            else if (currentLevelName.Contains("chuanggan"))
            {
                Ultilities.CleanMemory();
                Application.LoadLevel("ui");
            }
            else if (currentLevelName.Contains("login"))
            {
                ExitGameDialog.Popup();
            }


            EscPressed = true;
        }
    }
Ejemplo n.º 6
0
 public StickerControl(ConversationBoxControl conversationControl, string source)
 {
     InitializeComponent();
     ConversationControl = conversationControl;
     Source = source;
     ImageBehavior.SetAnimatedSource(StickerContent, Ultilities.ConvertBase64StringToBitmapImage(source));
 }
        private void MoveToCheckout()
        {
            Ultilities.SaveJson(products.Where(p => p.Count > 0).ToList(), "data.json");
            var intent = new Intent(this, typeof(Checkout));

            StartActivity(intent);
        }
Ejemplo n.º 8
0
        public void LoadChange(KeyValuePair <string, ConversationModel> model)
        {
            // update model
            this.Model = model;

            // Load conversation avatar
            this.ConversationAvatar.ImageSource = Ultilities.ConvertBase64StringToBitmapImage(Model.Value.Avatar);

            // Load conversation title
            this.ConversationTitle.Text = model.Value.Title;

            // Load new recived messages
            var messages = model.Value.Messages.Where(m => m.Value.SendTime > this.LoadedTime && m.Value.UserID != Service.UserID)
                           .OrderBy(m => m.Value.SendTime)
                           .ToDictionary(m => m.Key, m => m.Value);

            if (messages.Count > 0)
            {
                foreach (var message in messages)
                {
                    this.MessageContainer1.Children.Add(new ReceivedMessageControl(message));
                }
            }

            // change seen time
            this.LoadedTime = model.Value.ChangedTime;
            ConversationService.ChangeMemberSeenTime(Model.Key, Service.UserID, this.LoadedTime);

            this.ConversationScrollContainer.ScrollToEnd();

            //this.Loading.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 9
0
        private void GenerateRandomPowers()
        {
            List <int> randomNumbers = new List <int>();

            for (int i = 0; i < 4; i++)
            {
                randomNumbers.Add(Ultilities.randomNumber(0, PowerList.Count - 1));
            }

            power1DataLabel.Text = PowerList[randomNumbers[0]];
            power2DataLabel.Text = PowerList[randomNumbers[1]];
            power3DataLabel.Text = PowerList[randomNumbers[2]];
            power4DataLabel.Text = PowerList[randomNumbers[3]];

            Power power1 = new Power(power1DataLabel.Text, 1);
            Power power2 = new Power(power2DataLabel.Text, 2);
            Power power3 = new Power(power3DataLabel.Text, 3);
            Power power4 = new Power(power4DataLabel.Text, 4);

            Program.character.Powers = new List <Power>();
            Program.character.Powers.Add(power1);
            Program.character.Powers.Add(power2);
            Program.character.Powers.Add(power3);
            Program.character.Powers.Add(power4);
        }
Ejemplo n.º 10
0
    private void RandomizeDecision(HockeyPlayer h, HockeyPlayer other)
    {
        int choice = Random.Range(0, 10);

        switch (choice)
        {
        case 0:
            //strike
            Vector3 goalPos = new Vector3(
                isPlayerTeam ? 44f : -44f,
                0f,
                Random.Range(-5.5f, 5.5f));
            h.PassingPuck(goalPos, Ultilities.CalculateShootingPower(h.transform.position, goalPos) + 1);
            break;

        case 1:
        case 2:
        case 3:
            //pass ball
            h.PassingPuck(other.transform.position + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-2f, 2f)),
                          Ultilities.CalculateShootingPower(h.transform.position, other.transform.position));
            break;

        default:
            Vector3 posToMove = new Vector3(
                isPlayerTeam ? 38f : -38f,
                0f,
                Random.Range(-20f, 20f));
            h.MoveToPosition(posToMove);
            //move
            break;
        }
    }
Ejemplo n.º 11
0
    IEnumerator TiliRecoverCorou()
    {
        while (!destroyed)
        {
            System.TimeSpan ts1 = new System.TimeSpan(System.DateTime.Now.Ticks);
            System.TimeSpan ts2 = new System.TimeSpan(System.Convert.ToDateTime(SettingManager.Instance.TiliRecoverTime).Ticks);

            System.TimeSpan ts       = ts1.Subtract(ts2).Duration();
            int             count    = (int)(ts.TotalSeconds) / recoverDuration;
            int             remained = (int)(ts.TotalSeconds) % recoverDuration;
            count = SettingManager.Instance.TotalTili + count;
            SettingManager.Instance.TotalTili = Mathf.Min(20, count);

            if (SettingManager.Instance.TotalTili >= 20)
            {
                tiliRemained.gameObject.SetActive(false);
                EventService.Instance.GetEvent <TiliChangeEvent>().Publish(SettingManager.Instance.TotalTili);
                break;
            }
            else
            {
                tiliRemained.gameObject.SetActive(true);
                tiliRemained.text = Ultilities.ConvertSecondToTime(recoverDuration - remained);
                if (remained <= 0)
                {
                    SettingManager.Instance.TotalTili += 1;
                    EventService.Instance.GetEvent <TiliChangeEvent>().Publish(SettingManager.Instance.TotalTili);
                }
            }

            yield return(new WaitForSeconds(1));
        }
    }
Ejemplo n.º 12
0
    public string FormatString(string value)
    {
        value = value.Replace(".", "");
        bool foundComma = false;

        for (int i = value.Length - 1; i >= 0; i--)
        {
            if (value[i] == ","[0])
            {
                if (foundComma)
                {
                    value = value.Remove(i, 1);
                }
                else
                {
                    foundComma = true;
                }
            }
        }
        print("1- " + value);

        if (!foundComma)
        {
            value += ",00";
        }
        else
        {
            int commaPos = value.LastIndexOf(","[0]);
            value += "00";
            value  = value.Substring(0, commaPos + 3);
        }
        return(Ultilities.Money(Ultilities.ParseFloat(value)));
    }
 private bool ValidateJob()
 {
     if (Ultilities.StringIsEmptyOrNull(Job.Name))
     {
         SendDisplayAlert("Error", "Name is not allowed empty!");
         return(false);
     }
     if (Ultilities.StringIsEmptyOrNull(Job.Description))
     {
         SendDisplayAlert("Error", "Description is not allowed empty!");
         return(false);
     }
     if (Ultilities.StringIsEmptyOrNull(Job.Address))
     {
         SendDisplayAlert("Error", "Address is not allowed empty!");
         return(false);
     }
     if (Job.DateEnd < Job.DateStart)
     {
         SendDisplayAlert("Error", "Date Start have to less than Date End");
         return(false);
     }
     if (Job.DateEnd == Job.DateStart)
     {
         if (Job.TimeDeadLine < DateTime.Now.TimeOfDay)
         {
             SendDisplayAlert("Error", "Please choose another deadline!");
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 14
0
        private void openDialog()
        {
            string filePath = "";

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                string CombinedPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\Results\\");
                openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                //openFileDialog.FilterIndex = 2;
                openFileDialog.RestoreDirectory = true;

                openFileDialog.InitialDirectory = System.IO.Path.GetFullPath(CombinedPath);


                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    filePath = openFileDialog.FileName;
                    List <Hero> hero = Ultilities.ReadSerializedObjectFile <List <Hero> >(filePath);

                    //Save the hero to program
                    Program.character = hero[0];

                    //Write it into full label for all screen
                    updateLayout();
                }
            }
        }
Ejemplo n.º 15
0
        public void LoadChange(KeyValuePair <string, ConversationModel> model)
        {
            // update model
            this.Model = model;

            // update loaded time
            this.LoadedTime = DateTime.Now;

            // Load conversation avatar
            this.ConversationAvatar.ImageSource = Ultilities.ConvertBase64StringToBitmapImage(Model.Value.Avatar);

            // Load conversation title
            this.ConversationTitle.Text = model.Value.Title;

            // Load new recived messages
            var messages = model.Value.Messages.Where(m => m.Value.SendTime > this.LoadedTime && m.Value.UserID != Service.UserID)
                           .OrderBy(m => m.Value.SendTime)
                           .ToDictionary(m => m.Key, m => m.Value);

            if (messages.Count > 0)
            {
                foreach (var message in messages)
                {
                    this.MessageContainer1.Children.Add(new ReceivedMessageControl(message));
                }
            }
        }
Ejemplo n.º 16
0
    public void GotoNextLevel()
    {
//		if (SettingManager.Instance.TotalTili < 1)
//		{
//			NotEnoughTiliDialog.Popup();
//			return;
//		}
//
//		Time.timeScale = 1.2f;
//
//		if (SettingManager.Instance.TotalTili == 20)
//		{
//			SettingManager.Instance.TiliRecoverTime = System.DateTime.Now.ToString();
////			MainArea.Instance.StartRecoverTili();
//		}
//		GameData.Instance.AddTili(-1);

        GameData.Instance.GotoLevel(GameData.Instance.CurrentLevel + 1);
        DialogManager.Instance.CloseDialog();
        Camera.main.GetComponent <GrayscaleEffect>().enabled = false;
        GameData.Instance.LevelType = LevelType.RushLevel;
        GameData.Instance.Pause     = false;

        GameData.Instance.goldDouble     = false;
        GameData.Instance.bulletCapacity = 1f;
        Ultilities.CleanMemory();

        OtherDialog.Popup(Application.loadedLevelName);
//		Application.LoadLevel(Application.loadedLevelName);
    }
Ejemplo n.º 17
0
        private void LoadNames()
        {
            string firstNamePath = "../../Data/firstNames.txt";
            string lastNamePath  = "../../Data/lastNames.txt";

            FirstNameList = Ultilities.LoadNames(firstNamePath);
            LastNameList  = Ultilities.LoadNames(lastNamePath);
        }
Ejemplo n.º 18
0
        public void saveFile()
        {
            string fileName = "product.txt";

            Ultilities.WriteSerialObjectToFile(fileName, Program.product);
            this.Hide();
            Program.orderForm.Show();
        }
Ejemplo n.º 19
0
 private void tbDistrict_Leave(object sender, EventArgs e)
 {
     if (!Ultilities.IsValidDistrict(tbDistrict.Text.Trim()))
     {
         lbDisError.Visible = true;
         tbDistrict.Focus();
     }
 }
Ejemplo n.º 20
0
 private void tbPhoneNo_Leave(object sender, EventArgs e)
 {
     if (!Ultilities.IsValidPhoneNumber(tbPhoneNo.Text.Trim()))
     {
         lbPhoneError.Visible = true;
         tbPhoneNo.Focus();
     }
 }
Ejemplo n.º 21
0
 private void tbEmail_Leave(object sender, EventArgs e)
 {
     if (!Ultilities.IsValidEmail(tbEmail.Text.Trim()))
     {
         lbEmailError.Visible = true;
         tbEmail.Focus();
     }
 }
Ejemplo n.º 22
0
        public IEnumerable <ExternalLink> GetExternalLinkList(bool EnableStopWord, string Text)
        {
            List <ExternalLink> ExternalLinkList = new List <ExternalLink>();

            if (Ultilities.UrlCheck(Text))
            {
                WebClient webClient = new WebClient();
                try
                {
                    string HTMLDoc = webClient.DownloadString(Text);

                    MatchCollection MatchedString = Regex.Matches(HTMLDoc, @"(<a.*?>.*?</a>)", RegexOptions.Singleline);

                    foreach (Match MatchedItem in MatchedString)
                    {
                        string       Word             = MatchedItem.Groups[1].Value;
                        ExternalLink ExternalLinkItem = new ExternalLink();
                        if (!EnableStopWord)
                        {
                            Match MatchHref = Regex.Match(Word, @"href=\""(.*?)\""",
                                                          RegexOptions.Singleline);
                            if (MatchHref.Success)
                            {
                                ExternalLinkItem.Link = MatchHref.Groups[1].Value;
                            }

                            string t = Regex.Replace(Word, @"\s*<.*?>\s*", "",
                                                     RegexOptions.Singleline);
                            ExternalLinkItem.Name = t;
                            ExternalLinkList.Add(ExternalLinkItem);
                        }
                        else
                        {
                            if (!(StopWord.ListStopWord().Any(x => x.SWord.Equals(Word.ToLower()))))
                            {
                                Match MatchHref = Regex.Match(Word, @"href=\""(.*?)\""",
                                                              RegexOptions.Singleline);
                                if (MatchHref.Success)
                                {
                                    ExternalLinkItem.Link = MatchHref.Groups[1].Value;
                                }

                                string t = Regex.Replace(Word, @"\s*<.*?>\s*", "",
                                                         RegexOptions.Singleline);
                                ExternalLinkItem.Name = t;
                                ExternalLinkList.Add(ExternalLinkItem);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Write(ex.ToString());
                }
            }

            return(ExternalLinkList.OrderBy(x => x.Name));
        }
Ejemplo n.º 23
0
    // Update is called once per frame
    void Update()
    {
        var currentColor = hostSprite.color;

        currentColor.r   = Ultilities.CalculateAsymptoticAverage(currentColor.r, targetColor.r, followPercentage);
        currentColor.b   = Ultilities.CalculateAsymptoticAverage(currentColor.b, targetColor.b, followPercentage);
        currentColor.g   = Ultilities.CalculateAsymptoticAverage(currentColor.g, targetColor.g, followPercentage);
        hostSprite.color = currentColor;
    }
Ejemplo n.º 24
0
 protected bool IsTargetInRange()
 {
     if (Ultilities.GetDistanceBetween(gameObject, targetObject.gameObject) <= objectData.attackRange)
     //if ((transform.position - targetPosition).magnitude <= objectData.attackRange)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 25
0
    public void GotoLevelMenu()
    {
        Ultilities.CleanMemory();
#if US_VERSION
        Application.LoadLevel("chuanggan02_us");
#else
        Application.LoadLevel("chuanggan02");
#endif
    }
Ejemplo n.º 26
0
    public void LoadUIScene()
    {
        Ultilities.CleanMemory();
#if US_VERSION
        Application.LoadLevel("ui_us");
#else
        Application.LoadLevel("ui");
#endif
    }
Ejemplo n.º 27
0
        private void saveFile()
        {
            List <Hero> heroes = new List <Hero>();

            heroes.Add(Program.character);
            string CombinedPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\Results\\Henry.txt");

            Ultilities.WriteSerialObjectToFile(CombinedPath, heroes);
        }
Ejemplo n.º 28
0
    // Use this for initialization
    IEnumerator Start()
    {
        Debug.Log("level name " + levelName);
        yield return(new WaitForSeconds(1));

        Ultilities.CleanMemory();
        yield return(Application.LoadLevelAsync(levelName));

        yield return(new WaitForSeconds(1));
    }
Ejemplo n.º 29
0
 private void tbName_Leave(object sender, EventArgs e)
 {
     ((Bunifu.Framework.UI.BunifuMaterialTextbox)sender).Text =
         Ultilities.ToTitleCase(((Bunifu.Framework.UI.BunifuMaterialTextbox)sender).Text);
     if (!Ultilities.IsValidName(tbName.Text.Trim()))
     {
         lbNameError.Visible = true;
         tbName.Focus();
     }
 }
Ejemplo n.º 30
0
 public void Preencher(Compra compra)
 {
     NomeDoFornecedor.field.text = compra.Fornecedor;
     AreaDaCompra.value          = (int)compra.Area;
     DataDaCompra.field.text     = compra.Data;
     valorDaCompra.field.text    = Ultilities.Money(compra.Valor);
     formaDePagamento.value      = (int)compra.Pagamento;
     notaFiscal.text             = Ultilities.FormatarNF(compra.NotaFiscal);
     banco.value = (int)compra.Banco;
     obs.text    = compra.Obs;
 }