Exemple #1
0
        private async Task AnimateCardsBackToOwner()
        {
            List <Task <object> > taskList = new List <Task <object> >();
            CardView card = null;

            for (int i = GridPlayedCards.Items.Count - 1; i >= 0; i--)
            {
                card = GridPlayedCards.Items[i];
                if (card.Owner == Owner.Player)
                {
                    GridPlayedCards.MoveCardToTarget(card, GridPlayer, taskList);
                }
                else if (card.Owner == Owner.Computer)
                {
                    GridPlayedCards.MoveCardToTarget(card, GridComputer, taskList);
                }
                if (card.Orientation == CardOrientation.FaceDown)
                {
                    card.SetOrientation(CardOrientation.FaceUp, taskList);
                }
                if (card.AnimatedOpacity != 1.0)
                {
                    card.AnimateFade(1.0, taskList);
                }
            }

            await Task.WhenAll(taskList);

            CountControl.Hide();
        }
Exemple #2
0
        private async Task AnimateAllCardsBackToDeck(double duration = Double.MaxValue)
        {
            CountControl.Hide();
            if (duration == Double.MaxValue)
            {
                duration = MainPage.AnimationSpeeds.Medium;
            }

            // flip the cards and then move them for a nice affect

            List <Task <object> > list = new List <Task <object> >();

            GridPlayer.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayer.MoveAllCardsToTarget(GridDeck, list, duration);

            GridCrib.FlipAllCards(CardOrientation.FaceDown, list);
            GridCrib.MoveAllCardsToTarget(GridDeck, list, duration);

            GridPlayedCards.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayedCards.MoveAllCardsToTarget(GridDeck, list, duration);

            GridComputer.FlipAllCards(CardOrientation.FaceDown, list);
            GridComputer.MoveAllCardsToTarget(GridDeck, list, duration);

            foreach (CardView card in GridDeck.Items)
            {
                card.Reset();
            }

            GridDeck.UpdateCardLayout(list, duration, false);

            await Task.WhenAll(list);
        }
Exemple #3
0
        private void Move(string command)
        {
            var index = IndexControl.Get();
            var count = CountControl.Get();

            switch (command)
            {
            case Navigate.Bck: if (index > 0)
                {
                    IndexControl.Set(--index);
                }
                break;

            case Navigate.Fwd: if (index < count - 1)
                {
                    IndexControl.Set(++index);
                }
                break;

            case Navigate.Go:
                int newIndex;
                if (!int.TryParse(txtIndexControl.Text, out newIndex))
                {
                    newIndex = index + 1;
                }
                if (newIndex > 0 && newIndex <= count)
                {
                    IndexControl.Set(newIndex - 1);
                }
                break;
            }
            SetView(Views.Control);
        }
        private async Task OnCountResetUpdateUi()
        {
            CountControl.UpdateLayout();

            await GridPlayedCards.UpdateCardLayout();

            await GridComputer.UpdateCardLayout();

            await GridPlayer.UpdateCardLayout();

            if (Settings.HitContinueOnGo == true)
            {
                await HintWindow_ShowAndWait("Go!\n\nHit Continue.");
            }
            else
            {
                await Task.Delay(1000);
            }
            foreach (CardView c in GridPlayedCards.Items)
            {
                c.SetOrientationAsync(CardOrientation.FaceDown, MainPage.AnimationSpeeds.Medium);
            }
            UpdateCount(0);
            CountControl.UpdateLayout();
        }
Exemple #5
0
        private void SetSessionsCount()
        {
            int count = 0;

            do
            {
                count++;

                CountControl control = new CountControl(count.ToString(), false);
                StackSessions.Children.Add(control);
            } while (count < _timeController.Count);
        }
Exemple #6
0
        private void SetView(int view)
        {
            switch (view)
            {
            case Views.Vehiculos:
                ListControl.Set(null);
                gridVehiculos.DataSource = VehiculosPendientes;
                gridVehiculos.DataBind();
                IndexControl.Set(0);
                break;

            case Views.Control:
                if (!VehiculosSeleccionados.Any())
                {
                    ShowError(string.Format(CultureManager.GetError("MUST_SELECT_VALUE"), CultureManager.GetEntity("PARENTI03")));
                    SetView(Views.Vehiculos);
                    return;
                }
                if (ListControl.Get() == null)
                {
                    var viajes = GetDistribuciones(VehiculosSeleccionados).Where(x => !x.Controlado).Select(v => v.Id).ToList();
                    ListControl.Set(viajes);
                    CountControl.Set(viajes.Count);
                }
                var index = IndexControl.Get();
                var count = CountControl.Get();

                var viaje = GetDistribucionAControlar(index);
                BindViaje(viaje);

                txtIndexControl.Text = (index + 1).ToString("#0");
                lblCountControl.Text = count.ToString("#0");
                btSiguiente.Visible  = index < count - 1;
                btAnterior.Visible   = index > 0;

                break;

            case Views.Resumen:
                var distribuciones = GetDistribuciones(new[] { -1 });
                var controladas    = distribuciones.Where(d => d.Controlado).Select(d => new ViajeDistribucionVo(d)).ToList();
                //var noControladas = distribuciones.Where(d => !d.Controlado).ToList();

                gridResumen.GroupedColumns.Clear();
                gridResumen.GroupedColumns.Add(gridResumen.Columns[0] as C1Field);
                gridResumen.DataSource = controladas;
                gridResumen.DataBind();
                break;
            }

            tab.ActiveTabIndex  = view;
            updCompleto.Visible = true;
            updCompleto.Update();
        }
        private void DoBatchParse(object parameter)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");

                var dataList = FileUtils <DateMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = GeneralParser.ParseDate(csvMapper.DateStr);
                        if (parseResult[0].Equals(true))
                        {
                            csvMapper.Result = parseResult[1] as string;
                        }
                        else
                        {
                            csvMapper.Result    = "Parse Error";
                            csvMapper.Exception = parseResult[1] as string;
                        }

                        if (csvMapper.Result.Equals(csvMapper.Expected))
                        {
                            trueCnt++;
                        }
                        else
                        {
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <DateMapper> .WriteResult(dataList, "rNextDate.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
        public void BatchDeterTriFun(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");

                var dataList = FileUtils <TriangleMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = GeneralParser.ParseTriangle(csvMapper.A, csvMapper.B, csvMapper.C,
                                                                      GetParseTriangleStr);
                        csvMapper.Result = parseResult;

                        if (parseResult.Equals("不能构成三角形."))
                        {
                            csvMapper.Exception = "不能构成三角形.";
                        }

                        if (parseResult.Equals(csvMapper.Expected))
                        {
                            csvMapper.IsCorrect = "true";
                            trueCnt++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "false";
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <TriangleMapper> .WriteResult(dataList, "rTriangle.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
Exemple #9
0
        private void SliderSessionCount_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            StackSessions.Children.Clear();
            int count = 0;

            do
            {
                count++;

                CountControl control = new CountControl(count.ToString(), false);
                StackSessions.Children.Add(control);
            } while (count < SliderSessionCount.Value);

            Settings.UpdateSessionsCount(SliderSessionCount.Value);
        }
        private void BatchCalculateBabyBreak(object sender)
        {
            var filePath = GetInputCurWindowFilePath();

            if (null == filePath)
            {
                return;
            }
            InitReportVisuals();
            var dataList = FileUtils <BabyBreakCSV> .ReadDateList(filePath);

            if (null != dataList)
            {
                CountControl.SetTotal(dataList.Count);
                int trueCnt = 0, falseCnt = 0;

                foreach (var babyBreakCsv in dataList)
                {
                    var cnt = GetBabyBreakCount(
                        babyBreakCsv.is_woman,
                        babyBreakCsv.late_marriage,
                        babyBreakCsv.late_birth,
                        babyBreakCsv.less_7_month,
                        babyBreakCsv.dystocia,
                        babyBreakCsv.less_30_day
                        );

                    babyBreakCsv.Result = cnt.ToString();

                    if (cnt == babyBreakCsv.result_day)
                    {
                        trueCnt++;
                        babyBreakCsv.IsCorrect = "True";
                    }
                    else
                    {
                        falseCnt++;
                        babyBreakCsv.IsCorrect = "False";
                    }
                }
                CountControl.SetPassed(trueCnt);
                CountControl.SetFailed(falseCnt);
                //WriteResult(dataList);
                FileUtils <BabyBreakCSV> .WriteResult(dataList, "rBabyBreaks.csv");

                DefactPercentControl.SetValues(trueCnt, falseCnt);
            }
        }
        private void BatchCalculate(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                sellComputerBatchFlag = true;
                var dataList = FileUtils <ComputerMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    int passed, failed;
                    passed       = failed = 0;
                    CountControl = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow,
                                                                         "CaseCountControl");
                    DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                     "DefactPercentControl");

                    foreach (var csvMapper in dataList)
                    {
                        var strRes = GetSumStr(csvMapper.OutLet, csvMapper.MainFrame, csvMapper.Monitor);
                        if (strRes[0].Equals(csvMapper.Expected))
                        {
                            csvMapper.IsCorrect = "true";
                            passed++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "false";
                            failed++;
                        }

                        csvMapper.Result    = strRes[0];
                        csvMapper.Exception = strRes[1];
                    }

                    FileUtils <ComputerMapper> .WriteResult(dataList, "rComputerAccessories.csv");

                    CountControl.SetPassed(passed);
                    CountControl.SetFailed(failed);
                    CountControl.SetTotal(passed + failed);
                    DefactPercentControl.SetValues(passed, failed);
                }
            }
        }
        public void BatchTelecomCalFun(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");
                var dataList = FileUtils <TelecomMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = CalculateTelecomFee(csvMapper.minutes, csvMapper.times);
                        csvMapper.ResultDiscount = parseResult[0].ToString();
                        csvMapper.ResultFee      = parseResult[1].ToString();
                        if (Math.Abs(double.Parse(csvMapper.ExpectedDiscount) - parseResult[0]) < 1e10 - 3 &&
                            Math.Abs(double.Parse(csvMapper.ExpectedFee) - parseResult[1]) < 1e10 - 3)
                        {
                            csvMapper.IsCorrect = "True";
                            trueCnt++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "False";
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <TelecomMapper> .WriteResult(dataList, "rTelecom.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
        private void BatchCalculateProduct(object e)
        {
            var filePath = GetInputCurWindowFilePath();

            if (null == filePath)
            {
                return;
            }
            InitReportVisuals();
            var dataList = FileUtils <ProductionProductCSV> .ReadDateList(filePath);

            if (null != dataList)
            {
                CountControl.SetTotal(dataList.Count);
                int trueCnt = 0, falseCnt = 0;

                foreach (var productCSV in dataList)
                {
                    productCSV.实际结果 = GetProductProductionResult(
                        productCSV.销售合同订单量,
                        productCSV.库存量,
                        productCSV.生产库存量,
                        productCSV.生产质检合格,
                        productCSV.废品,
                        productCSV.采购质检合格,
                        productCSV.货已发完
                        );
                    if (productCSV.实际结果.Equals(productCSV.预期结果))
                    {
                        trueCnt++;
                    }
                    else
                    {
                        falseCnt++;
                    }
                }
                CountControl.SetPassed(trueCnt);
                CountControl.SetFailed(falseCnt);

                FileUtils <ProductionProductCSV> .WriteResult(dataList, "rProductProduction.csv");

                DefactPercentControl.SetValues(trueCnt, falseCnt);
            }
        }
Exemple #14
0
        private void StackSessions_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (StackSessions.Visibility != Visibility.Hidden)
            {
                return;
            }

            StackSessions.Children.Clear();
            int count = 0;

            do
            {
                count++;

                CountControl control = count <= _timeController.CountReady ?
                                       new CountControl(count.ToString(), true) : new CountControl(count.ToString(), false);

                StackSessions.Children.Add(control);
            } while (count < _timeController.Count);

            _playStop.StackCount = Visibility.Visible;
        }
Exemple #15
0
 public void ShowCountControl()
 {
     CountControl.Show();
     CountControl.Locate();
 }