public Task <bool?> InitModification(CoreViewModel vm) { var tcs = new TaskCompletionSource <bool?>(); _dispatcherService.CurrentDispatcher.BeginInvoke(new Action(() => { bool?result = null; Window activeWindow = null; for (var i = 0; i < Application.Current.Windows.Count; i++) { var win = Application.Current.Windows[i]; if ((win != null) && (win.IsActive)) { activeWindow = win; break; } } if (activeWindow != null) { var win = new EditWindow(vm) { Owner = activeWindow }; result = win.ShowDialog(); } tcs.SetResult(result); })); return(tcs.Task); }
private void Initialize() { // Show the window in normal state WindowState = WindowState.Normal; ServiceInjector.InjectServices(); _coreViewModel = new CoreViewModel(); DataContext = _coreViewModel; _coreViewModel.InitializeEnvironmentVariables(); switch (_coreViewModel.InitResult) { case InitResultType.InitOk: break; case InitResultType.AccessDenied: MessageBox.Show("Cannot access Environment variables! Please restart NVM# as an Administrator.", "NVM#"); Application.Current.Shutdown(); break; case InitResultType.OtherError: MessageBox.Show("NVM# encountered an error and needs to close!", "NVM#"); Application.Current.Shutdown(); break; } UserButton.IsChecked = true; SizeChanged += (o, a) => { switch (WindowState) { case WindowState.Maximized: SplitViewMenu.Width = (int)SplitViewMenuWidth.Wide; break; case WindowState.Normal: SplitViewMenu.Width = (int)SplitViewMenuWidth.Narrow; break; } RootGrid.ColumnDefinitions[0] = new ColumnDefinition { Width = new GridLength(SplitViewMenu.Width) }; RootGrid.InvalidateVisual(); }; // Enable the tooltip for SplitView menu buttons only if the SplitView width is narrow SplitViewMenu.SizeChanged += (o, a) => { var isNarrowMenu = (int)SplitViewMenu.Width == (int)SplitViewMenuWidth.Narrow; ToolTipService.SetIsEnabled(UserButton, isNarrowMenu); ToolTipService.SetIsEnabled(SystemButton, isNarrowMenu); ToolTipService.SetIsEnabled(ImportButton, isNarrowMenu); ToolTipService.SetIsEnabled(ExportButton, isNarrowMenu); ToolTipService.SetIsEnabled(AboutButton, isNarrowMenu); }; }
public EditWindow(CoreViewModel coreViewModel) { InitializeComponent(); _coreViewModel = coreViewModel; this.DataContext = coreViewModel; UpdateInputGrid(); UpdateSaveButtonState(); }
public static CoreViewModel GetProviderById(string id) { List <ProviderContact> list = new List <ProviderContact>(); var manager = PlugInManager.GetBookingDataManager(); var bp = manager.GetBookingProcess(id); int providerid = bp.AccProvider; var provider = manager.GetProviderForProviderId(providerid); CoreViewModel m = new CoreViewModel(); m.Id = provider.Id; m.Address = provider.Address; m.Country = provider.Country; m.Bank = provider.Bank; m.City = provider.City; m.Contacts = provider.Contacts; m.IBAN = provider.IBAN; m.Name = provider.Name; m.PersonalIdentificationNumber = provider.PersonalIdentificationNumber; m.Notes = provider.Notes; m.ProviderId = provider.ProviderId; m.Title = provider.Title; m.BookingEmail = provider.BookingEmail; m.Cancellations = provider.Cancellations; list = m.Contacts; ProviderContact contact = new ProviderContact(); contact.Email = provider.BookingEmail; list.Add(contact); m.Contacts = list; int counter = 0; foreach (var item in m.Contacts) { item.Id = (++counter).ToString(); } counter = 0; foreach (var item in m.Notes) { item.Id = (++counter).ToString(); } foreach (var item in m.Cancellations) { item.Id = (++counter).ToString(); } return(m); }
public BackButtonHandler(CoreViewModel coreViewModel) { _manager = SystemNavigationManager.GetForCurrentView(); _coreViewModel = coreViewModel; _manager.BackRequested += _manager_BackRequested; SetBinding(CanGoBackProperty, new Binding() { Path = new PropertyPath("CanGoBack"), Source = _coreViewModel }); }
// Kreiraj view za FormLayout na osnovu CoreViewModel objekta koji se koristi za prezentaciju Provider i B2BCustomer objekta public static LayoutFormViewModel GetLayoutFormViewModel(CoreViewModel model) { var layoutdata = new LayoutFormViewModel(); layoutdata.Bank = model.Bank; layoutdata.IBAN = model.IBAN; layoutdata.Name = model.Name; layoutdata.PersonalIdentificationNumber = model.PersonalIdentificationNumber; layoutdata.Country = model.Country; layoutdata.City = model.City; layoutdata.Address = model.Address; return(layoutdata); }
private IActionResult CoreElement(NetworkElement ne) { var childrenCap = repository.NetworkElements .Where(x => x.ParentId == ne.Id) .GroupBy(x => x.NetworkType) .Select(x => new CapacitySpecs { Type = x.Key, Count = x.Count(), SumInstalled = x.Sum(y => (long)y.InstalledCapacity), SumUsed = x.Sum(y => (long)y.UsedCapacity) }) .ToList(); var linksSpecsByLinkType = repository.Links .Where(l => l.End1Id == ne.Id) .GroupBy(x => x.Type) .Select(x => new LinksSpecsByLinkType() { Type = x.Key, Count = x.Count(), SumChannels = x.Sum(y => y.Channels) }) .ToList(); var linksSpecsByNeType = repository.Links .Where(l => l.End1Id == ne.Id) .GroupBy(x => x.End2.NetworkType) .Select(x => new LinksSpecsByNeType() { Type = x.Key, Count = x.Count(), SumChannels = x.Sum(y => y.Channels) }) .ToList(); var model = new CoreViewModel() { NE = repository.NetworkElements.Where(x => x.Id == ne.Id).Include(x => x.Exchange).First(), Remotes = childrenCap.Where(x => x.Type == NeType.Remote).FirstOrDefault(), Accesses = childrenCap.Where(x => x.Type == NeType.Access).FirstOrDefault(), CoreLinks = linksSpecsByNeType.Where(x => x.Type == NeType.Core).FirstOrDefault(), IsupLinks = linksSpecsByLinkType.Where(x => x.Type == LinkType.ISUP).FirstOrDefault(), SipLinks = linksSpecsByLinkType.Where(x => x.Type == LinkType.SIP).FirstOrDefault(), Miscs = repository.Miscs.OrderBy(x => x.Name).ToArray() }; return(View("Core", model)); }
// Kreiraj view za FormLayout na osnovu CoreViewModel objekta koji se koristi za prezentaciju Provider i B2BCustomer objekta public static LayoutCoreViewModel GetLayoutViewModel(CoreViewModel model) { var layoutdata = new LayoutCoreViewModel(); layoutdata.Bank = model.Bank; layoutdata.IBAN = model.IBAN; layoutdata.Name = model.Name; layoutdata.PersonalIdentificationNumber = model.PersonalIdentificationNumber; layoutdata.Country = model.Country; layoutdata.City = model.City; layoutdata.Address = model.Address; layoutdata.BookingEmail = model.BookingEmail; layoutdata.ProviderId = model.ProviderId; layoutdata.Title = model.Title; return(layoutdata); }
public RootViewModel( IViewModelFactory viewModelFactory, DialogManager dialogManager, SettingsService settingsService, UpdateService updateService) { _viewModelFactory = viewModelFactory; _dialogManager = dialogManager; _settingsService = settingsService; Core = viewModelFactory.CreateCoreViewModel(); DisplayName = $"{App.Name} v{App.VersionString}"; _checkForUpdatesTimer = new AutoResetTimer(async() => await updateService.CheckPrepareUpdateAsync()); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); using (var container = new UnityContainer().LoadConfiguration()) { this._store = container.Resolve <IScoreStore>(); } _viewmodel = new CoreViewModel(); _window = new MainWindow(); _viewmodel.LaunchGame += LaunchNewGame; _viewmodel.showScoreEvent += showScore; _window.DataContext = _viewmodel; _window.Show(); }
//Dohvati sve providere iz baze i mapiraj u view objekte i vrati listu public static List <CoreViewModel> GetProviderViewModel() { var model = new List <CoreViewModel>(); var manager = PlugInManager.GetBookingDataManager(); var providers = manager.GetProviders(); foreach (var provider in providers) { var m = new CoreViewModel(); m.Id = provider.Id; m.Address = provider.Address; m.Country = provider.Country; m.Bank = provider.Bank; m.City = provider.City; m.Contacts = provider.Contacts; m.IBAN = provider.IBAN; m.Name = provider.Name; m.PersonalIdentificationNumber = provider.PersonalIdentificationNumber; m.Notes = provider.Notes; m.ProviderId = provider.ProviderId; m.Title = provider.Title; m.BookingEmail = provider.BookingEmail; m.Cancellations = provider.Cancellations; int counter = 0; foreach (var item in m.Contacts) { item.Id = (++counter).ToString(); } counter = 0; foreach (var item in m.Notes) { item.Id = (++counter).ToString(); } foreach (var item in m.Cancellations) { item.Id = (++counter).ToString(); } model.Add(m); } return(model); }
protected void Page_Load(object sender, EventArgs e) { Uri u = HttpContext.Current.Request.Url; // id iz booking procesa id = HttpUtility.ParseQueryString(u.Query).Get("id"); statusname = HttpUtility.ParseQueryString(u.Query).Get("name"); lblStatusName.Text = statusname; // value iz comboboxa za select bookingmodel = bookingcontroller.GetBookingProcess(id); bookingdata = templatecontroller.GetValues(bookingmodel); value = HttpUtility.ParseQueryString(u.Query).Get("statusid"); parameter = HttpUtility.ParseQueryString(u.Query).Get("valueid"); if (!IsPostBack) { PageControlTemplate.ActiveTabIndex = 0; BindTemplates(); SetTemplate(); } int receiver = controller.GetReceiver(id, value); if (receiver == 1) { customermodel = customercontroller.GetCustomerById(id); comboboxTo.DataSource = customermodel.Contacts; comboboxTo.DataBind(); } else if (receiver == 2) { providermodel = providercontroller.GetCoreDataById(id); comboboxTo.DataSource = providermodel.Contacts; comboboxTo.DataBind(); } btnSave.Enabled = false; /* * comboboxTo.DataSource = model; * comboboxTo.DataBind();*/ BindTemplates(); BindContactsFrom(); }
// Mapiraj view objekt ,a to je CoreViewModel koji služi za prezentaciju Providera i B2BCustomera u B2BCustomer objekt te napravi update objekta u bazi public static void UpdateMasterDataB2BCustomer(CoreViewModel model) { var manager = PlugInManager.GetBookingDataManager(); var b2bcustomer = new B2BCustomer(); b2bcustomer.Id = model.Id; b2bcustomer.Address = model.Address; b2bcustomer.Country = model.Country; b2bcustomer.Bank = model.Bank; b2bcustomer.City = model.City; b2bcustomer.Contacts = model.Contacts; b2bcustomer.IBAN = model.IBAN; b2bcustomer.Name = model.Name; b2bcustomer.PersonalIdentificationNumber = model.PersonalIdentificationNumber; b2bcustomer.Notes = model.Notes; b2bcustomer.PartnerId = model.ProviderId; manager.UpdateMasterData(b2bcustomer); }
protected void GridB2BCustomerView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { CoreViewModel model = new CoreViewModel(); model.Address = e.NewValues["Address"].ToString(); model.Bank = e.NewValues["Bank"].ToString(); model.City = e.NewValues["City"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.IBAN = e.NewValues["IBAN"].ToString(); model.Name = e.NewValues["Name"].ToString(); model.PersonalIdentificationNumber = e.NewValues["PersonalIdentificationNumber"].ToString(); model.ProviderId = (int)e.NewValues["ProviderId"]; controller.Add(model); e.Cancel = true; GridB2BCustomerView.CancelEdit(); Bind(); }
protected void btnAdd_Click(object sender, EventArgs e) { string email = comboboxTo.Text; int receiver = controller.GetReceiver(id, value); if (receiver == 1) { customercontroller.CheckCustomerEmail(id, email); customermodel = customercontroller.GetCustomerById(id); comboboxTo.DataSource = customermodel.Contacts; comboboxTo.DataBind(); } else if (receiver == 2) { providercontroller.CheckEmail(id, email); providermodel = providercontroller.GetCoreDataById(id); comboboxTo.DataSource = providermodel.Contacts; comboboxTo.DataBind(); } }
protected void GridB2BCustomerView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { var list = (List <CoreViewModel>)GridB2BCustomerView.DataSource; CoreViewModel model = list.Find(m => m.Id == e.Keys[0].ToString()); model.Address = e.NewValues["Address"].ToString(); model.Bank = e.NewValues["Bank"].ToString(); model.City = e.NewValues["City"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.IBAN = e.NewValues["IBAN"].ToString(); model.Name = e.NewValues["Name"].ToString(); model.PersonalIdentificationNumber = e.NewValues["PersonalIdentificationNumber"].ToString(); model.ProviderId = (int)e.NewValues["ProviderId"]; controller.Update(model); e.Cancel = true; GridB2BCustomerView.CancelEdit(); Bind(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> private void OnLaunchedOrActivated(IActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (ViewModel == null) { ViewModel = new CoreViewModel(rootFrame); ViewModel.Initialize(); } new BackButtonHandler(ViewModel); // Ensure the current window is active Window.Current.Activate(); }
// Mapiraj view objekt ,a to je CoreViewModel koji služi za prezentaciju Providera i B2BCustomera u Provider objekt te ga pohrani u bazu public static void AddMasterData(CoreViewModel model) { var manager = PlugInManager.GetBookingDataManager(); var provider = new Provider(); provider.Id = Guid.NewGuid().ToString(); provider.Address = model.Address; provider.Country = model.Country; provider.Bank = model.Bank; provider.City = model.City; provider.Contacts = model.Contacts; provider.IBAN = model.IBAN; provider.Name = model.Name; provider.PersonalIdentificationNumber = model.PersonalIdentificationNumber; provider.Notes = model.Notes; provider.ProviderId = model.ProviderId; provider.Title = model.Title; provider.BookingEmail = model.BookingEmail; provider.Cancellations = model.Cancellations; manager.AddMasterData(provider); }
//Dohvati sve b2bcustomere iz baze i mapiraj u view objekte i vrati listu public static List <CoreViewModel> GetB2BCustomerViewModel() { var model = new List <CoreViewModel>(); var manager = PlugInManager.GetBookingDataManager(); var b2bcustomers = manager.GetB2BCustomers(); foreach (var b2bcustomer in b2bcustomers) { var m = new CoreViewModel(); m.Id = b2bcustomer.Id; m.Address = b2bcustomer.Address; m.Country = b2bcustomer.Country; m.Bank = b2bcustomer.Bank; m.City = b2bcustomer.City; m.Contacts = b2bcustomer.Contacts; m.IBAN = b2bcustomer.IBAN; m.Name = b2bcustomer.Name; m.PersonalIdentificationNumber = b2bcustomer.PersonalIdentificationNumber; m.Notes = b2bcustomer.Notes; m.ProviderId = b2bcustomer.PartnerId; int counter = 0; foreach (var item in m.Contacts) { item.Id = (++counter).ToString(); } counter = 0; foreach (var item in m.Notes) { item.Id = (++counter).ToString(); } model.Add(m); } return(model); }
private void Awake() { model.handler = this; viewModel = new CoreViewModel(model); }
public LayoutCoreViewModel GetCoreLayoutData(CoreViewModel model) { return(BookingDataCoreRepository.GetLayoutViewModel(model)); }
public LayoutFormViewModel GetLayoutData(CoreViewModel model) { var layoutmodel = BookingDataCoreRepository.GetLayoutFormViewModel(model); return(layoutmodel); }
public void Update(CoreViewModel model) { BookingDataCoreRepository.UpdateMasterDataB2BCustomer(model); }
public void Add(CoreViewModel model) { BookingDataCoreRepository.AddMasterDataB2BCustomer(model); }