public override void Execute(Caliburn.Micro.CoroutineExecutionContext context) { try { var binDir = Path.Combine(Workspace.WorkspaceDirectory, Constants.BinFolder); if (!Directory.Exists(binDir)) Directory.CreateDirectory(binDir); var copiedReferences = new List<string>(); foreach (var assemblyPath in assemblyPaths) { if (File.Exists(assemblyPath)) { var destFileName = Path.Combine(binDir, Path.GetFileName(assemblyPath)); File.Copy(assemblyPath, destFileName, true); copiedReferences.Add(destFileName); } } //make sure they are available for code completion Workspace.ReplExecutor.AddReferencesAndNotify(copiedReferences.ToArray()); OnCompleted(null); } catch (Exception ex) { OnCompleted(ex); } }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { try { if (files != null) { foreach (var file in files) { references.Add(file); } } if (assemblyNames != null) { foreach (var assemblyName in assemblyNames) { references.Add(new AssemblyReference(assemblyName)); } } OnCompleted(null); } catch (Exception ex) { OnCompleted(ex); } }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { ////add the whole folder //if(Directory.Exists(folder)) //{ // references.AddFilesAsGroup(folder); //} ////ceate a new group that doesnt correspond with a particular folder, add it and make it editable //else if(parent != null) //{ // var groupName = DefaultGroupName; // var counter = 1; // while (references.Groups.Contains(groupName)) // { // groupName = DefaultGroupName + counter; // counter++; // } // references.Groups.Add(new FileReferences(groupName)); // //find the new groupVM and make it editable // var newGroupVM = parent.Children.FirstOrDefault(item => item is FileReferencesViewModel && item.DisplayName == groupName); // if (newGroupVM != null) // newGroupVM.IsInEditMode = true; //} }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { if (cancelCallback != null) cancelCallback(); OnCompleted(this, new ResultCompletionEventArgs { WasCancelled = true }); }
//Filters implementing IHandlerAware are made aware of each trigger that could possibly activate the handler void IHandlerAware.MakeAwareOf(Caliburn.PresentationFramework.RoutedMessaging.IRoutedMessageHandler messageHandler, Caliburn.PresentationFramework.RoutedMessaging.IMessageTrigger trigger) { var monitor = messageHandler.Metadata.FirstOrDefaultOfType<ChangedEventMonitor>(); if (monitor != null) { monitor.AddTrigger(trigger); } }
//protected override void ConfigurePresentationFramework(Caliburn.PresentationFramework.Configuration.PresentationFrameworkConfiguration module) //{ // module.Using); // module.With.ShellFramework(); // base.ConfigurePresentationFramework(module); //} protected override void Configure(Caliburn.Core.Configuration.IConfigurationBuilder builder) { base.Configure(builder); builder.With.ShellFramework(); builder.With.PresentationFramework().Using(x => x.ViewModelBinder<NISViewModelBinder>()); //builder.With.Module<PresentationFrameworkConfiguration>(builder.With.Pre) // .Using(x => x.ViewModelBinder<NISViewModelBinder>()); }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { foreach (var file in files) { if(!File.Exists(file)) { CShell.Workspace.CreateEmptyFile(file); } } OnCompleted(null); }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { var dialog = (Mode == FileDialogMode.Open) ? new OpenFileDialog() as FileDialog : new SaveFileDialog(); dialog.FileName = file_name; dialog.Title = StringParser.Parse(title); dialog.Filter = StringParser.Parse(filter); if(dialog.ShowDialog().GetValueOrDefault()) File = dialog.FileName; base.Execute(context); }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { var dialog = Mode == FileDialogMode.Open ? new OpenFileDialog() as FileDialog : new SaveFileDialog(); dialog.FileName = fileName; dialog.Title = title; dialog.Filter = filter; dialog.ShowDialog(); File = dialog.FileName; base.Execute(context); }
//Filters implementing IHandlerAware are made aware of each IRoutedMessageHandler they handle; filter has //the opporunity to store some addictional helper or metadata in the specific handler instance void IHandlerAware.MakeAwareOf(Caliburn.PresentationFramework.RoutedMessaging.IRoutedMessageHandler messageHandler) { var monitor = messageHandler.Metadata.FirstOrDefaultOfType<ChangedEventMonitor>(); if (monitor == null && !string.IsNullOrEmpty(_actualEventPath)) { var eventPair = GetEventPair(messageHandler.Unwrap(), _actualEventPath); if (eventPair != null) { monitor = new ChangedEventMonitor(eventPair.EventInfo, eventPair.Sender, messageHandler); messageHandler.Metadata.Add(monitor); } } }
//Juries TODO improve (remove typing tied to contentfactory) private void ViewModelDeactivated(object sender, Caliburn.Micro.DeactivationEventArgs e) { if(e.WasClosed) { var container = _target as TabGroupPane; if(container != null) { WorkSurfaceContextViewModel model = sender as WorkSurfaceContextViewModel; if(model != null) { var vm = model.WorkSurfaceViewModel; var toRemove = container.Items.Cast<ContentPane>().ToList() .FirstOrDefault(p => p.Content != null && p.Content == vm); RemovePane(toRemove); if(toRemove != null && Application.Current != null && !Application.Current.Dispatcher.HasShutdownStarted) { container.Items.Remove(toRemove); } } } } }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { Result = MessageBox.Show(StringParser.Parse(text), StringParser.Parse(caption), buttons); base.Execute(context); }
void var_Deactivated(object sender, Caliburn.Micro.DeactivationEventArgs e) { GoToNextNode(); }
public override void Execute(Caliburn.Micro.CoroutineExecutionContext context) { Task.Run(() => { //if the document is null, open the references document if (Document == null) { if (FilePath == null) FilePath = Constants.ReferencesFile; Document = Shell.GetTextDocument(FilePath); } }) .ContinueWith(t => { if (t.IsFaulted) { OnCompleted(t.Exception); return; } try { var refsToInsert = ""; if (assemblyPaths != null) { foreach (var path in assemblyPaths) { refsToInsert += "#r \"" + GetReferencePath(path) + "\"" + Environment.NewLine; } } if (assemblyNames != null) { foreach (var assemblyName in assemblyNames) { refsToInsert += "#r \"" + assemblyName.FullName + "\"" + Environment.NewLine; } } if (!String.IsNullOrEmpty(refsToInsert)) { Document.Text = refsToInsert + Document.Text; Document.Save(); Workspace.ReplExecutor.Execute(refsToInsert, Document.DisplayName); } OnCompleted(null); } catch (Exception ex) { OnCompleted(ex); } }); }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { Result = MessageBox.Show(text, caption, buttons); base.Execute(context); }
public override void Execute(Caliburn.Micro.ActionExecutionContext context) { Task.Factory .StartNew(() => Thread.Sleep(TimeSpan.FromSeconds(4))) .ContinueWith(t => OnCompleted()); }
protected override void ConfigurePresentationFramework(Caliburn.PresentationFramework.Configuration.PresentationFrameworkConfiguration module) { module.Using(x => x.ViewModelBinder<NISViewModelBinder>()); base.ConfigurePresentationFramework(module); }
public void Initialize(Type targetType, System.Reflection.MemberInfo member, Caliburn.Core.InversionOfControl.IServiceLocator serviceLocator) { this._member = member; _serviceLocator = serviceLocator; _methodFactory = _serviceLocator.GetInstance<IMethodFactory>(); CreateMethod(_isInZoomMethodName, ref _isInZoomMethod, targetType); CreateMethod(_selectedItemsMethodName,ref _selectedItemsMethod, targetType); }