Esempio n. 1
0
 private void SaveLayout(ILayoutSetupViewModel layoutSetupViewModel)
 {
     TheDynamicTypeManager.Value.BeginGetEditableRoot<ILayoutEdit>(
         Constants.LayoutProcessName,
         SelectedLayout.Id,
         async (e, o) =>
             {
             if (o.Error == null)
             {
                 o.Object.LayoutDefinition = layoutSetupViewModel.GetSerializedString();
                 o.Object.Name = layoutSetupViewModel.Name;
                 var bo = ((BusinessBase)o.Object);
                 await ((ISavable)bo).SaveAsync();
                 await RefreshLayouts();
                 ThePopupFactory.Value.NotifySuccess(LanguageService.Translate("Msg_SuccessfullySaved"));
             }
         });
 }
Esempio n. 2
0
        private void SaveNewLayout(string value, ILayoutSetupViewModel layoutSetupViewModel)
        {
            if (LayoutList.Any(x => x.Name == value))
                return;

            TheDynamicTypeManager.Value.BeginNewEditableRoot<ILayoutEdit>(
                Constants.LayoutProcessName,
                async (s, e) =>
                    {
                        if (e.Error == null)
                {
                    e.Object.Name = value;
                    e.Object.LayoutDefinition = layoutSetupViewModel.GetSerializedString();
                    e.Object.IsAdminDefault = false;
                    e.Object.ProcessSystemName = SearchViewModel.ProcessSystemName;
                    e.Object.Account = Utils.CurrentUserAccountId == -1 ? null : (int?)Utils.CurrentUserAccountId;
                    try
                    {
                        await ((ISavable)e.Object).SaveAsync();
                        await RefreshLayouts();
                        SelectedLayout = LayoutList.FirstOrDefault(l => l.Id == e.Object.Id);
                    }
                    catch (Exception ex)
                    {
                        ThePopupFactory.Value.NotifyFailure(ex);
                    }
                }
                else
                {
                    ThePopupFactory.Value.NotifyFailure(e.Error);
                }
            });
        }
Esempio n. 3
0
 private static void Static(WeakEventListener<LayoutListViewModel, ILayoutSetupViewModel, PropertyChangedEventArgs> listener, ILayoutSetupViewModel source)
 {
     source.PropertyChanged -= listener.OnEvent;
 }