caliburn.micro

Error on guard clause with Caliburn.Micro

江枫思渺然 提交于 2019-12-06 13:54:37
I am trying to implement so guard handling with Caliburn.Micro but I am getting an invalid cast exception when the application runs. The Property: public Account UserAccount { get { return account; } set { account = value; NotifyOfPropertyChange(() => UserAccount); NotifyOfPropertyChange(() => CanSaveAndNavigateToComposeView()); } } The Method: public void SaveAndNavigateToComposeView() { CommitAccountToStorage(); navigationService.UriFor<ComposeViewModel>().Navigate(); } The Guard: public bool CanSaveAndNavigateToComposeView() { return !(string.IsNullOrEmpty(UserAccount.DisplayName) || string

WPF // MahApps.Metro // Caliburn.Micro // Flyout // HeaderedContentControl

三世轮回 提交于 2019-12-06 12:07:26
Since a change in MahApps.Metro 1.5.0 the base element of a Flyout was changed from ContentControl to HeaderContentControl . Now the MVVM approach with Caliburn.Micro and this suggestion doesn't work anymore. Has anybody else tried to solve this issue in a nice MVVM way? While I haven't tried it myself but since the new Flyout control is now based on HeaderedContentControl it would be a simple logic choice to attempt to do this instead of the previous, which was based on ContentControl . Looks like the advantages of this change were the elimination of a couple of dependency properties...

Caliburn Micro : passing Object between ViewModel

牧云@^-^@ 提交于 2019-12-06 11:51:19
I'm developing a simple Crud Application (a windows 8.1 store application) using Caliburn Micro 2.0.0-alpha2 I'm in trouble with navigation between viewmodels, passing object. I read many times the solution proposed by Anders Gustafsson ( How to pass parameter to navigated view model with WinRT Caliburn.Micro? ) and i tried to adapt it to my scope. But the object is alwais null. I need to pass a single object selected from a listView to my crudPage. The crudPage is composed by an userControl that shown the FormView. So i want to initialize this Form, with the values of the passed object. I

Caliburn.Micro and event aggregator -unwanted call handle method

ε祈祈猫儿з 提交于 2019-12-06 08:13:16
I have one problem with publish/handle messages between 2 screens. My scenario is: Messenger screen, is it master screen, publish on chat screens, they are slave screens. Messenger view model handle with messages from server. Chat screen can publishes messages on messenger screen. And messanger view model send this message on server. Messenger class look like this: [Export("MessengerScreen", typeof(IMessengerViewModel))] public class MessengerViewModel : Screen, IMessengerViewModel, IInitializable<Account>, IHandle<Rp> { // ... [ImportingConstructor] public MessengerViewModel(IPokecService

Playing a sound in Silverlight with MediaElement and Caliburn Micro

谁说胖子不能爱 提交于 2019-12-06 08:12:51
问题 How can I play an MP3 in Silverlight using Caliburn Micro? The MediaElement's "play()" method needs to be executed based on a boolean variable in the ViewModel. Thanks in advance! 回答1: Use an IResult. sample code Edit: based on a Boolean value, if you describe the scenario of this I can alter the sample. View: <Grid> <MediaElement AutoPlay="False" Source="../Assests/Kalimba.mp3"></MediaElement> <Button x:Name="Play" Content="Play" Height="50" Width="150" /> </Grid> ViewModel: public class

Caliburn Micro WPF Window Management

房东的猫 提交于 2019-12-06 08:01:05
问题 I'm wanting to start a WPF application using caliburn.micro so I can use TDD as much as possible, I've used caliburn.micro before with WP7 but WPF seems to be a different ship, and the documentation isn't as complete as that for WP7. I've set up the project with my Bootstrapper public class ApplicationBootstrapper : Bootstrapper { private SimpleContainer _container; private WindowManager _windowManager; protected override void Configure() { _container = new SimpleContainer(); _windowManager =

Caliburn.Micro: Recovering from Exception in IResult

我只是一个虾纸丫 提交于 2019-12-06 07:55:06
This was posted at Caliburn.Micro discussions also. I'm really looking for advice and opinions on the best way to solve. Say I have the following Action public IEnumerable<IResult> SaveStation() { yield return Busy.MakeBusy(); yield return new StationSave(_station); yield return Busy.MakeNotBusy(); yield return Show.Tab<StationBrowseViewModel>(); } StationSave is an IResult wrapper around a simple (WCF) service invocation. The service uses FaultContract/FaultException for failures. In the case of a fault, the user needs to be notified and the FaultContract will contain some useful info about

Custom caliburn.micro splashscreen with shell screen conductor

夙愿已清 提交于 2019-12-06 07:16:41
问题 I'm new to WPF and Caliburn.micro and I'd like to implement a custom splashscreen to a WPF App using Caliburn. I'm looking at the right way to do it with a screen conductor (as I understood it is the best solution). My Bootstrapper looks like this : public class AppBootstrapper : BootstrapperBase { private bool actuallyClosing; private CompositionContainer container; public AppBootstrapper() { Start(); } protected override void Configure() { container = new CompositionContainer( new

Dynamic menus with Caliburn micro

回眸只為那壹抹淺笑 提交于 2019-12-06 06:52:59
问题 I use Caliburn micro for my WPF Project. Static menus are easy to bind with Caliburn <Menu Grid.Row="0" IsMainMenu="True"> <MenuItem Header="_File"> <MenuItem x:Name="OpenScript" Header="_Open script"/> </MenuItem> <MenuItem Header="_Script"> <MenuItem x:Name="RunScript" Header="_Run script" /> <MenuItem x:Name="StopScript" Header="_Stop script" /> </MenuItem> <MenuItem Header="S_ettings"> <MenuItem x:Name="Plugins" Header="_Plugins">...Clickable children here</MenuItem> </MenuItem> </Menu>

How do I set a Window/Application icon in a application set up with Caliburn.Micro

大憨熊 提交于 2019-12-06 04:13:05
问题 I think I am missing something obvious. But since the main window of my Application is a UserControl that is being launched by protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor<MainWindowViewModel>(); } in my bootstrapper how do I set the Icon of the window itself and of the application in the toolbar? 回答1: XAML based solution : Change your MainWindowView base class from UserControl to Window (both in .xaml and in .xaml.cs), then set your Icon property