public async Task<IActionResult> Mapping(ImportModel model, DialogModel dm)
 {
     string file = _sessionService.GetValue("importfile");
     if (file.IsEmpty() || (model.DataFile != null && !file.IsCaseInsensitiveEqual(model.DataFile.FileName)))
     {
         //model.DataFileName = model.DataFile.FileName;
         model.DataFileName = model.EntityName + "_" + DateTime.Now.ToString("yyyyMMddhhmmsssss") + System.IO.Path.GetExtension(model.DataFile.FileName);// model.DataFile.FileName;
         file = ImportDirectory + "/" + model.DataFileName;
         await model.DataFile.SaveAs(file, _settingFinder, _webHelper).ConfigureAwait(false);
         _sessionService.Set("importfile", model.DataFileName, 5);
     }
     else
     {
         model.DataFileName = file;
         file = ImportDirectory + "/" + file;
     }
     var columns = ExcelHelper.GetColumns(file);
     var attributes = _attributeFinder.FindByEntityId(model.EntityId);
     var mapData = new Dictionary<string, Schema.Domain.Attribute>();
     foreach (var c in columns)
     {
         var attr = attributes.Find(n => n.LocalizedName.IsCaseInsensitiveEqual(c));//匹配到系统字段
         mapData.Add(c, attr);
     }
     model.MapData = mapData;
     model.Attributes = attributes;
     model.ImportMaps = _importMapService.Query(x => x.Where(f => f.TargetEntityName == model.EntityName));
     ViewBag.dialogmodel = dm;
     return View(model);
 }
        //[HttpPost]
        public IActionResult Dialog(WebResourceModel model, DialogModel dm)
        {
            FilterContainer <WebResource.Domain.WebResource> container = FilterContainerBuilder.Build <WebResource.Domain.WebResource>();

            container.And(n => n.OrganizationId == CurrentUser.OrganizationId);
            if (model.SolutionId.HasValue && !model.SolutionId.Value.Equals(Guid.Empty))
            {
                container.And(n => n.SolutionId == model.SolutionId.Value);
            }
            if (model.Name.IsNotEmpty())
            {
                container.And(n => n.Name.Like(model.Name));
            }
            if (model.WebResourceType.HasValue)
            {
                container.And(n => n.WebResourceType == model.WebResourceType.Value);
            }
            var result = _webResourceFinder.QueryPaged(x => x
                                                       .Select(s => new { s.WebResourceId, s.WebResourceType, s.Name, s.Description, s.CreatedOn })
                                                       .Where(container)
                                                       .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))
                                                       );

            model.Items             = result.Items;
            model.TotalItems        = result.TotalItems;
            ViewData["DialogModel"] = dm;

            return(View(model));
        }
Exemple #3
0
 public void Restart()
 {
     //SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     roomsLeftToVisit = rooms.Where(kvp => kvp.Key != 'A' && kvp.Key != 'F').ToDictionary(kvp => kvp.Key, kvp => kvp.Value).Keys.ToList();
     dialogs          = JsonUtility.FromJson <DialogModel>(dialogsJson.text);
     Freeze();
     ChangeRoom('A', false, false);
 }
Exemple #4
0
        private void ResetButton_Clicked(object sender, EventArgs e)
        {
            DialogModel model = this.BindingContext as DialogModel;

            model.SelectedDate   = _defaulDatetValue.Date;
            model.SelectedHour   = _defaulDatetValue.Hour;
            model.SelectedMinute = _defaulDatetValue.Minute;
        }
Exemple #5
0
    void Start()
    {
        // Use this to init all the dialog lines contained in Resources/dialogs.txt
        TextAsset   jsonString = Resources.Load("dialogs") as TextAsset;
        DialogModel dialogs    = JsonUtility.FromJson <DialogModel>(jsonString.text);

        dialog = GetComponent <Dialog>();
        dialog.ShowText(introText, dialogs.welcome, skippable: false);
    }
Exemple #6
0
        protected virtual void OnSelected(DialogModel model)
        {
            OnDialogSelected handler = DialogSelected;

            if (handler != null)
            {
                handler(this, model);
            }
        }
Exemple #7
0
        /// <summary>
        /// 弹出信息对话框
        /// </summary>
        /// <param name="message"></param>
        /// <param name="subForm"></param>
        public static void ShowDialog(string message, MyWindow.AfterCloseDelegate afterClose)
        {
            var model = new DialogModel();

            model._Message = message;
            var form = new DialogForm(MessageBoxButton.YesNo, MessageBoxImage.Question, model);

            //form.Width = 400;
            form.Height = 160;
            ShowDialogForm("提示信息", form, model, afterClose);
        }
Exemple #8
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string uriParam = "";

            if (NavigationContext.QueryString.TryGetValue("modelId", out uriParam))
            {
                dialogToReturn = TelegramSession.Instance.Dialogs.Model.Dialogs[(int.Parse(uriParam))];
            }
        }
Exemple #9
0
        /// <summary>
        /// 弹出信息对话框
        /// </summary>
        /// <param name="message"></param>
        /// <param name="subForm"></param>
        public static void ShowErr(string message, MyWindow.AfterCloseDelegate afterClose = null)
        {
            var model = new DialogModel();

            model._Message = message;
            var form = new DialogForm(MessageBoxButton.OK, MessageBoxImage.Error, model);

            //form.Width = 400;
            form.Height = 160;
            ShowDialogForm("错误信息", form, model, afterClose);
        }
        public static Task <bool?> ShowErrorDialogAsync(this IAsyncDialogService dialogService, Exception error)
        {
            var         caption = StringResources.AnErrorOccuredExclamation;
            DialogModel dialogModel;

#if DEBUG
            dialogModel = new DialogModel(error.ToString(), caption);
#else
            dialogModel = new DialogModel(error.Message, caption);
#endif
            return(dialogService.ShowDialogAsync(dialogModel));
        }
Exemple #11
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            Dictionary <DialogType, List <DialogGraphAsset> > dialogGroupDict = new Dictionary <DialogType, List <DialogGraphAsset> >();

            for (int i = 0; i < assets.Count; i++)
            {
                if (assets[i] is DialogGraphAsset)
                {
                    DialogGraphAsset asset = assets[i] as DialogGraphAsset;
                    if (!dialogGroupDict.ContainsKey(asset.dialogType))
                    {
                        dialogGroupDict.Add(asset.dialogType, new List <DialogGraphAsset>());
                    }
                    dialogGroupDict[asset.dialogType].Add(asset);
                }
            }

            foreach (var item in dialogGroupDict)
            {
                TBDialogCnf cnfTab = new TBDialogCnf();

                List <DialogModel> dialogs = new List <DialogModel>();

                DialogType dialogType = item.Key;
                List <DialogGraphAsset> dialogAssets = item.Value;
                foreach (var dialogAsset in dialogAssets)
                {
                    BaseGraph graphData = dialogAsset.DeserializeGraph();
                    dialogs.AddRange(SerializeToDialogModel(graphData, dialogAsset));
                }

                for (int i = 0; i < dialogs.Count; i++)
                {
                    DialogModel tModel = dialogs[i];
                    if (cnfTab.ContainsKey(tModel.id))
                    {
                        Debug.LogError($"Dialog配置生成失败,重复的对话Id>>>>{tModel.id}");
                        return;
                    }
                    else
                    {
                        cnfTab.Add(tModel.id, tModel);
                    }
                }

                string filePath = DialogDef.GetDialogCnfPath(dialogType);
                IOHelper.WriteText(JsonMapper.ToJson(dialogs), filePath);
                Debug.Log($"对话生成成功》》》{filePath}");
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Exemple #12
0
        private bool IsAnyActionDialog(DialogModel dialog)
        {
            foreach (ActionDialogModel actionDialogModel in _actionDialogModels)
            {
                if (actionDialogModel.Dialogs.Contains(dialog))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #13
0
        public async Task <DialogModel> GetDialogAsync(string dialogId)
        {
            if (!dialogId.IsValidPartitionOrRowKey())
            {
                throw new ValidationApiException($"{nameof(dialogId)} is invalid");
            }

            IClientDialog dialog = await _clientDialogsService.GetDialogAsync(dialogId);

            DialogModel result = Mapper.Map <DialogModel>(dialog);

            return(result);
        }
Exemple #14
0
        public IActionResult SelectActionsDialog(PrivilegeModel model, DialogModel dm)
        {
            ViewData["DialogModel"] = dm;
            var result = AssemblyService.GetAllActionByAssembly();

            if (model.ClassName.IsNotEmpty())
            {
                result = result.Where(n => n.ClassName.IndexOf(model.ClassName, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
            }
            model.Items      = result.Skip((model.Page - 1) * model.PageSize).Take(model.PageSize).ToList();
            model.TotalItems = result.Count;
            return(View(model));
        }
Exemple #15
0
        public async Task <DialogModel> UpdateDialogAsync([FromBody][CustomizeValidator(RuleSet = "*")] DialogModel model)
        {
            var existingDialog = await _clientDialogsService.GetDialogAsync(model.Id);

            if (existingDialog == null)
            {
                throw new ValidationApiException("Dialog not found");
            }

            IClientDialog dialog = Mapper.Map <ClientDialog>(model);
            var           result = await _clientDialogsService.AddDialogAsync(dialog);

            return(Mapper.Map <DialogModel>(result));
        }
Exemple #16
0
        private void NextPhase()
        {
            _phaseStep++;
            if (_phaseStep >= _raid.RaidPhases.Count)
            {
                HandleRaidEnd();
                return;
            }

            _dialogStep = -1;
            _raidPhase  = _raid.RaidPhases[_phaseStep];
            _dialog     = _raidPhase.Intro;
            NextStep();
        }
Exemple #17
0
        public void UpdateTypings()
        {
            Deployment.Current.Dispatcher.BeginInvoke(delegate {
                foreach (var dialogModel in model.Dialogs)
                {
                    dialogModel.UpdateTypings();

                    DialogModel openedDialog = OpenedDialog;
                    if (openedDialog != null)
                    {
                        openedDialog.OpenedRead();
                    }
                }
            });
        }
Exemple #18
0
        ActionResult ProcessDialog(DialogModel model, int answer, string message)
        {
            if (this.ModelState.IsValid)
            {
                var data = new { id = answer, valor = "Mensagem " + answer };
                if (model.Value == answer)
                {
                    return(this.DialogResult(message, data)); // Close dialog via DialogResult call
                }

                this.ModelState.AddModelError(string.Empty, string.Format("Invalid input value. The correct value is {0}", answer));
            }

            return(this.PartialView(model));
        }
Exemple #19
0
        public void ChooseDialog(int option)
        {
            if (_dialog == _raidPhase.Intro)
            {
                _dialog = _raidPhase.Dialogs[option];
            }
            else
            {
                _dialog = ActionUtil.PerformAction(_actionDialogModels, option);
            }

            AnimateText.SetTextButtonInteractable(true);
            NextStep();
            DialogOptions.HideDialogOptions();
        }
Exemple #20
0
        /// <returns>Next Dialog or null, if no reaction from village.</returns>
        public static DialogModel Raid(ActionDialogModel actionDialogModel)
        {
            int nextDialog = GetDialogIdByCondition(actionDialogModel);

            Viking.Score += actionDialogModel.Score[nextDialog];
            Debug.Log(Viking.Score);

            DialogModel dialogModel = null;

            if (nextDialog > -1)
            {
                dialogModel = actionDialogModel.Dialogs[nextDialog];
            }
            return(dialogModel);
        }
Exemple #21
0
        public IActionResult AttachmentsDialog(AttachmentsModel model, DialogModel dm)
        {
            if (!Arguments.HasValue(model.EntityId, model.ObjectId))
            {
                return(JError(T["parameter_error"]));
            }
            model.EntityMetaData     = _entityFinder.FindByName("attachment");
            model.AttributeMetaDatas = _attributeFinder.FindByEntityId(model.EntityMetaData.EntityId);
            var result = _attachmentFinder.QueryPaged(model.Page, model.PageSize, model.EntityId, model.ObjectId);

            model.Items             = result.Items;
            model.TotalItems        = result.TotalItems;
            ViewData["DialogModel"] = dm;
            return(View(model));
        }
Exemple #22
0
        public City(DataTypes.WorldData.City c)
        {
            AbsolutePosition = c.Position;
            RelativePosition = c.Position;
            State = c.State;
            clearedDialogue = new DialogModel(c.ClearedDialogAsset);
            unlockedDialogue = new DialogModel(c.UnlockedDialogAsset);
            newlyUnlockedDialogue = new DialogModel(c.NewlyUnlockedDialogAsset);
            successDialogue = new DialogModel(c.SuccessAsset);
            Name = c.Name;

            Unlocked = new Models.City[] { null, null, null };

            Data = c;
        }
Exemple #23
0
        ActionResult ProcessDialog(DialogModel model, int answer, string message)
        {
            if (ModelState.IsValid)
            {
                if (model.Value == answer)
                {
                    return(this.DialogResult(message));  // Close dialog via DialogResult call
                }
                else
                {
                    ModelState.AddModelError("", string.Format("Invalid input value. The correct value is {0}", answer));
                }
            }

            return(PartialView(model));
        }
Exemple #24
0
        public async Task <DialogModel> AddDialogAsync([FromBody][CustomizeValidator(RuleSet = "new")] DialogModel model)
        {
            if (!string.IsNullOrEmpty(model.Id))
            {
                var existingDialog = await _clientDialogsService.GetDialogAsync(model.Id);

                if (existingDialog != null)
                {
                    throw new ValidationApiException("Dialog is already exists, use update method to change this dialog");
                }
            }

            IClientDialog dialog = Mapper.Map <ClientDialog>(model);
            var           result = await _clientDialogsService.AddDialogAsync(dialog);

            return(Mapper.Map <DialogModel>(result));
        }
        private Task <DateTime?> CreateDialog(Page currentPage, DialogModel vm)
        {
            var tcs = new TaskCompletionSource <DateTime?>();

            Device.BeginInvokeOnMainThread(async() =>
            {
                var page = new DialogPage(vm);

                await currentPage.Navigation.PushModalAsync(page);

                var value = await vm.GetValue();

                await currentPage.Navigation.PopModalAsync();

                tcs.SetResult(value);
            });

            return(tcs.Task);
        }
Exemple #26
0
        public DialogForm(MessageBoxButton button, MessageBoxImage image, DialogModel model)
        {
            this.Button = button;

            InitializeComponent();
            _Model          = model;
            lblMessage.Text = model._Message;

            if (MessageBoxImage.Error.Equals(image))
            {
                pnlBack.Background = CommonUtils.CommonUtil.ToBrush("#CD5555");
            }

            if (button == MessageBoxButton.OK)
            {
                var btn = new MyButton();
                btn._Text   = "OK";
                btn._Height = 30;
                btn._Width  = 70;
                btn._Click += OK_Click;
                btnList.Children.Add(btn);
            }

            else if (button == MessageBoxButton.YesNo)
            {
                var btn1 = new MyButton();
                btn1._Text   = "Yes";
                btn1.Height  = 30;
                btn1.Width   = 70;
                btn1.Margin  = new Thickness(10, 0, 10, 0);
                btn1._Click += OK_Click;
                btnList.Children.Add(btn1);

                var btn2 = new MyButton();
                btn2._Text   = "No";
                btn2._Height = 30;
                btn2._Width  = 70;
                btn2.Margin  = new Thickness(10, 0, 10, 0);
                btn2._Click += Cancel_Click;
                btnList.Children.Add(btn2);
            }
        }
Exemple #27
0
        public DialogModel getMessageListByPart(int userId, int count, int number, string keyDialog)
        {
            //get message by part + get info about communicatin + full profile info list (вызывать запрос при входе в диалог)
            //read

            var db                   = new MyDBModels.DB();
            var user                 = db.user.Where(u => u.UserId == userId).First();
            var myProfileId          = user.ProfileId;
            var currentCommunication = db.communication.Where(c => c.KeyDialog == keyDialog).First();

            DialogModel dialogDodel = new DialogModel();

            if (number == 1)
            {
                dialogDodel.DialogInfo = createInfoAboutUserCommunication(currentCommunication, myProfileId);
            }
            dialogDodel.Messages = createMessageList(db, count, number, keyDialog, userId);

            return(dialogDodel);
        }
Exemple #28
0
        public DialogViewModel(Dialog dialog)
        {
            _model    = new DialogModel(dialog);
            _messages = new ObservableCollection <MessageViewModel>(
                _model.Messages.Select(m => new MessageViewModel(m)));
            Messages = new ReadOnlyObservableCollection <MessageViewModel>(_messages);
            Watch(_model.Messages, _messages);

            SendMessageCommand = new DelegateCommand(() =>
            {
                if (!string.IsNullOrEmpty(MessageText))
                {
                    _model.SendMessage(MessageText);
                    MessageText = null; // Clear message.
                    RaisePropertyChanged("MessageText");
                }
            });

            UpdateDialogCommand = new DelegateCommand(() => { _model.UpdateDialog(); });
        }
 public IActionResult Import(Guid entityId, DialogModel dm)
 {
     var entityMetadata = _entityFinder.FindById(entityId);
     if (entityMetadata == null)
     {
         return NotFound();
     }
     ImportModel model = new ImportModel
     {
         EntityId = entityId
         ,
         EntityName = entityMetadata.Name
         ,
         DataFileName = _sessionService.GetValue("importfile")
         ,
         DuplicateDetection = 1
     };
     ViewBag.dialogmodel = dm;
     return View(model);
 }
Exemple #30
0
    private void Start()
    {
        // Use this to init all the dialog lines contained in Resources/dialogs.txt
        dialogsJson = Resources.Load("dialogs") as TextAsset;
        dialogs     = JsonUtility.FromJson <DialogModel>(dialogsJson.text);

        foreach (GameObject o in Resources.LoadAll <GameObject>("Rooms"))
        {
            char name = o.name[0];
            rooms.Add(name, o);
            if (name != 'A' && name != 'F')
            {
                roomsLeftToVisit.Add(name);
            }
        }
        doorPrefab = Resources.Load <GameObject>("Door");
        LoadRoom('A', spawnEnemies: false);
        ChangePlayerMovement('A');
        ChangePlayerAttack('A');
    }
        public Task <DateTime?> Show(Page currentPage, DialogSettings settings = null)
        {
            //initialize settings
            DialogSettings ds          = new DialogSettings();
            DateTime       defaultDate = DateTime.Now;

            ds.BackgroudColor        = settings != null && settings.BackgroudColor.HasValue ? settings.BackgroudColor.Value : currentPage.BackgroundColor;
            ds.OkButtonText          = settings != null && !string.IsNullOrEmpty(settings.OkButtonText) ? settings.OkButtonText : "OK";
            ds.CancelButtonText      = settings != null && !string.IsNullOrEmpty(settings.CancelButtonText) ? settings.CancelButtonText : "CANCEL";
            ds.SelectedDate          = settings != null && settings.SelectedDate.HasValue ? settings.SelectedDate.Value : defaultDate;
            ds.SelectedHour          = settings != null && settings.SelectedHour.HasValue ? settings.SelectedHour.Value : defaultDate.Hour;
            ds.SelectedMinute        = settings != null && settings.SelectedMinute.HasValue ? settings.SelectedMinute.Value : defaultDate.Minute;
            ds.MinimumDate           = settings != null && settings.MinimumDate.HasValue ? settings.MinimumDate.Value : DateTime.MinValue;
            ds.MaximumDate           = settings != null && settings.MaximumDate.HasValue ? settings.MaximumDate.Value : DateTime.MaxValue;
            ds.HourMinTextColor      = settings != null && settings.HourMinTextColor.HasValue ? settings.HourMinTextColor.Value : Color.Black;
            ds.ButtonsColor          = settings != null && settings.ButtonsColor.HasValue ? settings.ButtonsColor.Value : Color.FromHex("#2196F3");
            ds.CurrentMonthDaysColor = settings != null && settings.CurrentMonthDaysColor.HasValue ? settings.CurrentMonthDaysColor.Value : Color.Black;
            var vm = new DialogModel(ds);

            return(CreateDialog(currentPage, vm));
        }
        public void SendMessage(DialogModel newMessage)
        {
            Message msg = new Message();
            msg.SenderAccountID = newMessage.SenderID;
            msg.RecepientAccountID = newMessage.RecepientID;
            msg.Datetime = DateTime.Now;
            msg.Subject = newMessage.Subject;
            msg.MessageText = newMessage.MessageText;

            _db.Messages.AddObject(msg);
            _db.SaveChanges();
        }