コード例 #1
0
        public LabelContent(LabelViewModel viewModel)
        {
            ViewModel = viewModel;
            Style     = Application.Current.FindResource("LabelItemStyle") as Style;
            var control = new LabelViewControl(ViewModel);

            Content = control;
        }
コード例 #2
0
        internal static Object ObjectToFile_1(LabelViewModel originData)
        {
            try
            {
                FileData_1 ret = new FileData_1()
                {
                    FileVersion = originData.FileVersion,
                    TextList    = new List <TextFile_1>(),
                    BarcodeList = new List <BarcodeFile_1>(),

                    RuleSequentialNumList = new List <RuleSequFile_1>(),
                    RuleTimeList          = new List <RuleTimeFile_1>(),
                    RuleManualList        = new List <RuleManuFile_1>(),
                    RuleInputList         = new List <RuleInputFile_1>(),
                    RuleInputCombineList  = new List <RuleInputCombineFile_1>()
                };

                ret.Label = LabelToFile_1(originData.Label);

                foreach (var obj in originData.ObjectList)
                {
                    ObjectListToFile_1(obj, ret.TextList, ret.BarcodeList);
                }

                foreach (var rule in originData.RuleList)
                {
                    switch (rule.Format)
                    {
                    case RuleRegulation.RuleFormat.SEQUENTIAL_NUM:
                        RuleSequentialNumToFile_1(rule, ret.RuleSequentialNumList);
                        break;

                    case RuleRegulation.RuleFormat.TIME:
                        RuleTimeToFile_1(rule, ret.RuleTimeList);
                        break;

                    case RuleRegulation.RuleFormat.MANUAL_LIST:
                        RuleManualListToFile_1(rule, ret.RuleManualList);
                        break;

                    case RuleRegulation.RuleFormat.INPUT:
                        RuleInputListToFile_1(rule, ret.RuleInputList);
                        break;

                    case RuleRegulation.RuleFormat.INPUT_COMBINE:
                        RuleInputCombineFile_1(rule, ret.RuleInputCombineList);
                        break;
                    }
                }

                return(ret);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
        }
コード例 #3
0
 public ActionResult Index54()
 {
     //display for is for iterating over a collection
     LabelViewModel labelViewModel = new LabelViewModel();
     labelViewModel.Employees = new List<string>();
     labelViewModel.Employees.Add("emp1");
     labelViewModel.Employees.Add("emp2");
     return View(labelViewModel);
 }
コード例 #4
0
    public void OnPointerOver(LabelViewModel labelViewModel)
    {
        var affectedLabelViewModels = GetAssociatedLabels(labelViewModel);

        foreach (var lvm in affectedLabelViewModels)
        {
            lvm.Highlight(triggerSource: labelViewModel);
        }
    }
コード例 #5
0
 public void OnFade(LabelViewModel source)
 {
     foreach (var lvm in source.IsBlackListed ? LabelsBlackList : LabelsWhiteList)
     {
         if (!lvm.IsHighlighted)
         {
             lvm.Fade(source);
         }
     }
 }
コード例 #6
0
ファイル: AboutViewModel.cs プロジェクト: Tamitras/RaspiApp
        public AboutViewModel()
        {
            ButtonUdpViewModel       = new ButtonViewModel(true, "UDP ", Color.IndianRed);
            ButtonTcpViewModel       = new ButtonViewModel(true, "TCP ", Color.IndianRed);
            ButtonWcfViewModel       = new ButtonViewModel(true, "WCF ", Color.IndianRed);
            ButtonStartStopViewModel = new ButtonViewModel(true, "Play/Pause ", Color.BlueViolet);
            LabelCurrentSongTitle    = new LabelViewModel(true, "Keine Daten empfangen", Color.BlueViolet);

            Title = "Am Server verbinden";
        }
コード例 #7
0
    public void SwapLabel(LabelViewModel labelViewModel)
    {
        var affectedLabelViewModels = GetAssociatedLabels(labelViewModel);

        foreach (var lvm in affectedLabelViewModels)
        {
            lvm.Swap();
        }

        OnSelectionChanged();
    }
コード例 #8
0
ファイル: ViewTools.cs プロジェクト: Taredushi/MVC_projekt
        public LabelViewModel GetLabelViewModel(Label label, ApplicationDbContext db)
        {
            LabelViewModel labelView = new LabelViewModel()
            {
                ID          = label.LabelID,
                Name        = label.Name,
                BooksNumber = db.BookItems
                              .Count(a => a.LabelGroups.Any(x => x.Label.LabelID == label.LabelID))
            };

            return(labelView);
        }
        internal static IHtmlContent GenerateHtml <TModel, TProperty>(
            IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > propertyLambdaExpression,
            LabelViewModel labelOptions         = null,
            HintViewModel hintOptions           = null,
            FormGroupViewModel formGroupOptions = null,
            string classes = null,
            TextInputAppendixViewModel textInputAppendix = null,
            string type         = "text",
            string autocomplete = null
            )
            where TModel : GovUkViewModel
        {
            PropertyInfo property = ExpressionHelpers.GetPropertyFromExpression(propertyLambdaExpression);

            string propertyName = property.Name;

            TModel model = htmlHelper.ViewData.Model;

            string currentValue = ExtensionHelpers.GetCurrentValue(model, property, propertyLambdaExpression);

            string id = $"GovUk_{propertyName}";

            if (labelOptions != null)
            {
                labelOptions.For = id;
            }

            var textInputViewModel = new TextInputViewModel
            {
                Name              = $"GovUk_Text_{propertyName}",
                Id                = id,
                Value             = currentValue,
                Label             = labelOptions,
                Hint              = hintOptions,
                FormGroup         = formGroupOptions,
                Classes           = classes,
                TextInputAppendix = textInputAppendix,
                Type              = type,
                Attributes        = new Dictionary <string, string> {
                    { "autocomplete", autocomplete }
                }
            };

            if (model.HasErrorFor(property))
            {
                textInputViewModel.ErrorMessage = new ErrorMessageViewModel {
                    Text = model.GetErrorFor(property)
                };
            }

            return(htmlHelper.Partial("/GovUkDesignSystemComponents/TextInput.cshtml", textInputViewModel));
        }
コード例 #10
0
 /// <summary>
 ///		Crea una etiqueta
 /// </summary>
 private Control CreateLabel(LabelViewModel scape)
 {
     return(new Label
     {
         Content = scape.Text.ToString(),
         HorizontalContentAlignment = HorizontalAlignment.Center,
         VerticalContentAlignment = VerticalAlignment.Center,
         FontSize = 16,
         FontWeight = FontWeights.Bold,
         Tag = scape
     });
 }
コード例 #11
0
        //  Mysql_DataProvider  mysql_data = new Mysql_DataProvider();
        //public Idbprovider sqlite_data = new SQlite_DataProvider();
        public MainWindow()
        {
            Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("Teal"),
                                        ThemeManager.GetAppTheme("BaseDark"));
            InitializeComponent();
            labelViewModel   = new LabelViewModel(DialogCoordinator.Instance);
            RefrubHistoryObj = new RefrubHistoryObj();
            DataContext      = labelViewModel;
        }
コード例 #12
0
        public IActionResult CreateLabel(LabelViewModel model)
        {
            if (ModelState.IsValid)
            {
                var label = _mapper.Map <LabelViewModel, Label>(model);
                label.AddedBy = _admin.Fullname;

                _planRepository.CreateLabel(label);

                return(RedirectToAction("labeltable"));
            }
            return(View(model));
        }
コード例 #13
0
        // GET: Labels/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LabelViewModel label = this.service.FindLabelById(id);

            if (label == null)
            {
                return(HttpNotFound());
            }
            return(View(label));
        }
コード例 #14
0
        private async void OnSaveTitleButtonCliked(object sender, EventArgs e)
        {
            var title_data = new LabelViewModel
            {
                Label = editor.Text,
                Date  = DateTime.Now
            };

            LabelVievModelCollection.Add(title_data);
            var mainpage = new MainPage(LabelVievModelCollection);

            mainpage.BindingContext = title_data;
            await Navigation.PushAsync(mainpage);
        }
コード例 #15
0
        internal static IHtmlContent GenerateHtml <TModel>(
            IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, string> > propertyLambdaExpression,
            int?rows = null,
            LabelViewModel labelOptions         = null,
            HintViewModel hintOptions           = null,
            FormGroupViewModel formGroupOptions = null
            )
            where TModel : GovUkViewModel
        {
            PropertyInfo property = ExpressionHelpers.GetPropertyFromExpression(propertyLambdaExpression);

            ThrowIfPropertyDoesNotHaveCharacterCountAttribute(property);

            string propertyName = property.Name;

            TModel model = htmlHelper.ViewData.Model;

            string currentValue = ExtensionHelpers.GetCurrentValue(model, property, propertyLambdaExpression);

            string id = $"GovUk_{propertyName}";

            if (labelOptions != null)
            {
                labelOptions.For = id;
            }

            int maximumCharacters = GetMaximumCharacters(property);

            var characterCountViewModel = new CharacterCountViewModel {
                Name      = $"GovUk_Text_{propertyName}",
                Id        = id,
                MaxLength = maximumCharacters,
                Value     = currentValue,
                Rows      = rows,
                Label     = labelOptions,
                Hint      = hintOptions,
                FormGroup = formGroupOptions
            };

            if (model.HasErrorFor(property))
            {
                characterCountViewModel.ErrorMessage = new ErrorMessageViewModel {
                    Text = model.GetErrorFor(property)
                };
            }

            return(htmlHelper.Partial("/GovUkDesignSystemComponents/CharacterCount.cshtml", characterCountViewModel));
        }
コード例 #16
0
        private void AddLabel(LabelViewModel newLVM)
        {
            if (!CheckLicense())
            {
                return;
            }

            if (newLVM != null)
            {
                var newView = new LabelView();
                newView.DataContext = newLVM;
                LabelViewList.Add(newView);
                SelectedLabelView = newView;
            }
        }
コード例 #17
0
        protected List<LabelViewModel> toLabelViewModelList<T>(ICollection<T> model) where T : BasisLabel
        {
            List<LabelViewModel> returnList = new List<LabelViewModel>();
            foreach (T ikl in model)
            {
                LabelViewModel lvm = new LabelViewModel
                {
                    Id = ikl.LabelId,
                    Naam = ikl.Label.Naam
                };
                returnList.Add(lvm);

            }
            return returnList;
        }
コード例 #18
0
 public LabelViewModel[] GetAssociatedLabels(LabelViewModel labelViewModel)
 {
     if (labelViewModel.IsBlackListed)
     {
         var associatedPocketLabels = NonPrivatePockets.OrderBy(x => x.Labels.Count()).First(x => x.Labels.Contains(labelViewModel.Value)).Labels;
         return(LabelsBlackList.Where(x => associatedPocketLabels.Contains(x.Value)).ToArray());
     }
     else
     {
         var associatedPockets      = NonPrivatePockets.Where(x => x.Labels.Contains(labelViewModel.Value));
         var notAssociatedPockets   = NonPrivatePockets.Except(associatedPockets);
         var allNotAssociatedLabels = SmartLabel.Merge(notAssociatedPockets.Select(x => x.Labels));
         return(LabelsWhiteList.Where(x => !allNotAssociatedLabels.Contains(x.Value)).ToArray());
     }
 }
コード例 #19
0
        private List <LabelViewModel> inkomstLabelNaarLabel(ICollection <InkomstLabel> inkomstLabels)
        {
            List <LabelViewModel> returnList = new List <LabelViewModel>();

            foreach (InkomstLabel ikl in inkomstLabels)
            {
                LabelViewModel lvm = new LabelViewModel
                {
                    Id   = ikl.LabelId,
                    Naam = ikl.Label.Naam
                };
                returnList.Add(lvm);
            }
            return(returnList);
        }
コード例 #20
0
        internal static IHtmlContent GenerateHtml <TModel, TProperty>(
            IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > propertyLambdaExpression,
            LabelViewModel labelOptions         = null,
            HintViewModel hintOptions           = null,
            FormGroupViewModel formGroupOptions = null,
            string classes = null,
            TextInputAppendixViewModel textInputAppendix = null
            )
            where TModel : GovUkViewModel
        {
            var property = ExpressionHelpers.GetPropertyFromExpression(propertyLambdaExpression);

            var propertyName = property.Name;

            var model = htmlHelper.ViewData.Model;

            var id           = $"GovUk_{propertyName}";
            var currentValue = ExtensionHelpers.GetCurrentValue(model, property, propertyLambdaExpression);

            if (labelOptions != null)
            {
                labelOptions.For = id;
            }

            var textInputViewModel = new TextInputViewModel
            {
                Name              = $"GovUk_Text_{propertyName}",
                Id                = id,
                Value             = currentValue,
                Label             = labelOptions,
                Hint              = hintOptions,
                FormGroup         = formGroupOptions,
                Classes           = classes,
                TextInputAppendix = textInputAppendix
            };

            if (model.HasErrorFor(property))
            {
                textInputViewModel.ErrorMessage = new ErrorMessageViewModel {
                    Text = model.GetErrorFor(property)
                }
            }
            ;

            return(htmlHelper.Partial("~/Partials/TextInput.cshtml", textInputViewModel));
        }
    }
コード例 #21
0
 public static IHtmlContent GovUkCheckboxItemFor <TModel>(
     this IHtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, bool> > propertyLambdaExpression,
     LabelViewModel labelOptions = null,
     HintViewModel hintOptions   = null,
     Conditional conditional     = null,
     bool disabled = false)
 {
     return(CheckboxItemHtmlGenerator.GenerateHtml(
                htmlHelper,
                propertyLambdaExpression,
                labelOptions,
                hintOptions,
                conditional,
                disabled));
 }
コード例 #22
0
        public IActionResult Create(LabelViewModel model)
        {
            if (ModelState.IsValid)
            {
                var label = new Label {
                    LabelName = model.LabelName
                };
                _databaseContext.Label.Add(label);


                TempData["Success"] = true;
                _databaseContext.SaveChanges();
            }

            return(RedirectToAction(nameof(Index)));
        }
コード例 #23
0
 public static IHtmlContent GovUkCharacterCountFor <TModel>(
     this IHtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, string> > propertyLambdaExpression,
     int?rows = null,
     LabelViewModel labelOptions         = null,
     HintViewModel hintOptions           = null,
     FormGroupViewModel formGroupOptions = null)
     where TModel : GovUkViewModel
 {
     return(CharacterCountHtmlGenerator.GenerateHtml(
                htmlHelper,
                propertyLambdaExpression,
                rows,
                labelOptions,
                hintOptions,
                formGroupOptions));
 }
コード例 #24
0
 public static async Task <IHtmlContent> GovUkFileUploadFor <TModel>(
     this IHtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, IFormFile> > propertyLambdaExpression,
     LabelViewModel labelOptions         = null,
     HintViewModel hintOptions           = null,
     FormGroupViewModel formGroupOptions = null,
     string classes = null)
     where TModel : GovUkViewModel
 {
     return(await FileUploadHtmlGenerator.GenerateHtml(
                htmlHelper,
                propertyLambdaExpression,
                labelOptions,
                hintOptions,
                formGroupOptions,
                classes));
 }
        internal static IHtmlContent GenerateHtml <TModel>(
            IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, string> > propertyLambdaExpression,
            int?rows = null,
            LabelViewModel labelOptions         = null,
            HintViewModel hintOptions           = null,
            FormGroupViewModel formGroupOptions = null
            )
            where TModel : GovUkViewModel
        {
            PropertyInfo property = ExpressionHelpers.GetPropertyFromExpression(propertyLambdaExpression);

            string propertyName = property.Name;

            TModel model = htmlHelper.ViewData.Model;

            string currentValue = ExtensionHelpers.GetCurrentValue(model, property, propertyLambdaExpression);

            string id = $"GovUk_{propertyName}";

            if (labelOptions != null)
            {
                labelOptions.For = id;
            }

            var textAreaViewModel = new TextAreaViewModel
            {
                Name      = $"GovUk_Text_{propertyName}",
                Id        = id,
                Value     = currentValue,
                Rows      = rows,
                Label     = labelOptions,
                Hint      = hintOptions,
                FormGroup = formGroupOptions
            };

            if (model.HasErrorFor(property))
            {
                textAreaViewModel.ErrorMessage = new ErrorMessageViewModel {
                    Text = model.GetErrorFor(property)
                };
            }

            return(htmlHelper.Partial("/GovUkDesignSystemComponents/Textarea.cshtml", textAreaViewModel));
        }
コード例 #26
0
 public static IHtmlContent GovUkTextInputFor <TModel>(
     this IHtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, int?> > propertyLambdaExpression,
     LabelViewModel labelOptions         = null,
     HintViewModel hintOptions           = null,
     FormGroupViewModel formGroupOptions = null,
     string classes = null,
     TextInputAppendixViewModel textInputAppendix = null)
     where TModel : GovUkViewModel
 {
     return(TextInputHtmlGenerator.GenerateHtml(
                htmlHelper,
                propertyLambdaExpression,
                labelOptions,
                hintOptions,
                formGroupOptions,
                classes,
                textInputAppendix));
 }
コード例 #27
0
        /// <summary>
        /// Добавление десериализуемого объекта
        /// </summary>
        public void Add(IFormObject formObject)
        {
            IObjectViewModel viewModel = null;

            if (formObject is CheckBoxObject)
            {
                viewModel = new CheckBoxViewModel((CheckBoxObject)formObject, _dataProvider);
            }
            else if (formObject is LabelObject)
            {
                viewModel = new LabelViewModel((LabelObject)formObject, _dataProvider);
            }
            else if (formObject is TextBoxObject)
            {
                viewModel = new TextBoxViewModel((TextBoxObject)formObject, _dataProvider);
            }
            else if (formObject is RadioButtonObject)
            {
                viewModel = new RadioViewModel((RadioButtonObject)formObject, _dataProvider);
            }
            else if (formObject is DateBoxObject)
            {
                viewModel = new DatePickerViewModel((DateBoxObject)formObject, _dataProvider);
            }
            else if (formObject is TimePickerObject)
            {
                viewModel = new TimePickerViewModel((TimePickerObject)formObject, _dataProvider);
            }

            if (viewModel == null)
            {
                return;
            }

            viewModel.Properties.Left       = formObject.Left;
            viewModel.Properties.Top        = formObject.Top;
            viewModel.Properties.IsSelected = false;
            viewModel.Properties.SetVisibility(formObject.IsVisible);
            viewModel.Properties.TabId = formObject.TabId;
            ViewModels.Add(viewModel);
            ObjectModified?.Invoke(viewModel.Properties.Id);
        }
コード例 #28
0
        public static IHtmlContent GenerateHtml <TModel>(
            IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, bool> > propertyLambdaExpression,
            LabelViewModel labelOptions = null,
            HintViewModel hintOptions   = null,
            Conditional conditional     = null,
            bool disabled   = false,
            string onChange = null)
        {
            PropertyInfo property     = ExpressionHelpers.GetPropertyFromExpression(propertyLambdaExpression);
            string       propertyName = property.Name;

            TModel model     = htmlHelper.ViewData.Model;
            bool   isChecked = ExpressionHelpers.GetPropertyValueFromModelAndExpression(model, propertyLambdaExpression);

            if (labelOptions != null)
            {
                labelOptions.For = propertyName;
            }

            var attributesDictionary = new Dictionary <string, string>();

            if (onChange != null)
            {
                attributesDictionary.Add("onChange", onChange);
            }

            var checkboxItemViewModel = new CheckboxItemViewModel
            {
                Id          = propertyName,
                Name        = propertyName,
                Value       = true.ToString(),
                Label       = labelOptions,
                Hint        = hintOptions,
                Conditional = conditional,
                Disabled    = disabled,
                Checked     = isChecked,
                Attributes  = attributesDictionary
            };

            return(htmlHelper.Partial("/GovUkDesignSystemComponents/CheckboxItem.cshtml", checkboxItemViewModel));
        }
コード例 #29
0
        public IActionResult EditLabel(LabelViewModel model)
        {
            if (ModelState.IsValid)
            {
                var label = _mapper.Map <LabelViewModel, Label>(model);

                var labelToUpdate = _planRepository.GetLabelById(model.Id);

                if (labelToUpdate == null)
                {
                    return(NotFound());
                }
                label.ModifiedBy = _admin.Fullname;

                _planRepository.UpdateLabel(labelToUpdate, label);

                return(RedirectToAction("labeltable"));
            }
            return(View(model));
        }
コード例 #30
0
        private static bool SaveLabel_FileDialog(ref LabelViewModel labelData)
        {
            bool ret;

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "NK Label-File | *.nkl";
            saveFileDialog.Title  = "Save a Label File";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                ret = SaveLabel_Xml(ref labelData, saveFileDialog.FileName);
            }
            else
            {
                ret = true;
            }

            return(ret);
        }
コード例 #31
0
        public LabelView()
        {
            InitializeComponent();

            BindingContext = new LabelViewModel();
        }