Example #1
0
        private bool ShowMain(List <MutableTuple <Int32, PL, TE> > plList, NativeActivityContext context)
        {
            var    model = GetMainModel(plList);
            string menuResult;

            if (RclShowDialogSourceActivity.ShowDialog(model, out menuResult) != true)
            {
                return(false);
            }

            while (true)
            {
                switch (model.MenuResult)
                {
                case "Value":
                    var id = model[PlListPropertyName] as MutableTuple <Int32, PL, TE>;
                    if (id == null)
                    {
                        ShowWarning("Список не выбран");
                        return(false);
                    }
                    SelectedPl.Set(context, id);
                    model.UpdateSource();
                    break;

                default:
                    return(false);
                }
                return(true);
            }
        }
        private bool ShowMain(List <Product> prdList)
        {
            var    model = GetMainModel(prdList);
            string menuResult;

            if (RclShowDialogSourceActivity.ShowDialog(model, out menuResult) != true)
            {
                return(false);
            }

            while (true)
            {
                switch (model.MenuResult)
                {
                case "Value":
                    var id = model[ProductListModelPropertyName] as decimal?;
                    if (!id.HasValue)
                    {
                        ShowWarning("Не выбран товар. Выберите товар.");
                        continue;
                    }
                    _selectedPrd = id.Value;
                    model.UpdateSource();
                    break;

                default:
                    return(false);
                }
                return(true);
            }
        }
Example #3
0
        private void ShowTimerForm()
        {
            var model      = GetTimerFormModel();
            var field      = model.GetField(TimerFieldName);
            var timervalue = field == null || field.Value == null?TimeSpan.FromSeconds(0) : (TimeSpan)field.Value;

            var timer = new DispatcherTimer
            {
                Interval  = TimeSpan.FromSeconds(1),
                IsEnabled = true
            };

            timer.Tick += delegate
            {
                if (field != null)
                {
                    timervalue            = timervalue.Add(timer.Interval);
                    model[TimerFieldName] = timervalue;
                }
            };

            while (true)
            {
                string menuResult;
                if (RclShowDialogSourceActivity.ShowDialog(model, out menuResult) != true)
                {
                    continue;
                }

                if (menuResult == "1Return")
                {
                    timer.IsEnabled = false;
                    if (TimerValue != null && field != null)
                    {
                        TimerValue.Set(_context, field.Value == null ? TimeSpan.FromSeconds(0) : (TimeSpan)field.Value);
                    }
                    break;
                }
            }
        }