public MoviesViewModel() { movieService = ServiceContainer.Resolve<IMovieService>(); messageDialog = ServiceContainer.Resolve<IMessageDialog>(); storageService = ServiceContainer.Resolve<IStorageService>(); NeedsUpdate = true; }
public LoginViewModel (IMeetupService meetupService, ILogin login, IMessageDialog dialog) : base(meetupService) { this.login = login; this.dialog = dialog; ExecuteRefreshLoginCommand (); }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.view_expense); dialog = ServiceContainer.Resolve<IMessageDialog>(); var id = Intent.GetIntExtra("ID", -1); viewModel = ServiceContainer.Resolve<ExpenseViewModel>(); await viewModel.Init(id); this.ActionBar.Title = viewModel.Title; viewModel.IsBusyChanged = (busy) => { if (busy) AndHUD.Shared.Show(this, "Loading..."); else AndHUD.Shared.Dismiss(this); }; name = FindViewById<EditText>(Resource.Id.name); date = FindViewById<DatePicker>(Resource.Id.date); notes = FindViewById<EditText>(Resource.Id.notes); total = FindViewById<EditText>(Resource.Id.total); billable = FindViewById<CheckBox>(Resource.Id.billable); category = FindViewById<Spinner>(Resource.Id.category); category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories); category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category)); name.Text = viewModel.Name; date.DateTime = viewModel.Due; notes.Text = viewModel.Notes; total.Text = viewModel.Total; billable.Checked = viewModel.Billable; }
public EventViewModel(IMeetupService meetupService, IMessageDialog messageDialog, IDataService dataService) : base(meetupService) { members = new ObservableCollection<MemberViewModel> (); this.messageDialog = messageDialog; this.dataService = dataService; random = new Random (); }
public WelcomeViewModel() { random = new Random(); messages = ServiceContainer.Resolve<IMessageDialog>(); var game = FileCache.ReadGameData(); GameLoaded = !string.IsNullOrWhiteSpace(game); if (GameLoaded) Game = JsonConvert.DeserializeObject<Game>(game); }
void QuestQuestionPage_Loaded(object sender, RoutedEventArgs e) { if (initialized) return; initialized = true; messages = ServiceContainer.Resolve<IMessageDialog>(); Hint.Text = QuestPage.ViewModel.Quest.Question.Text; CurrentQuest.Text = QuestPage.ViewModel.CompletionDisplayShort; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); App.CurrentActivity = this; messages = ServiceContainer.Resolve<IMessageDialog>(); SetContentView(Resource.Layout.quest_question); // Create your application here var cancelButton = FindViewById<Button>(Resource.Id.button_cancel); cancelButton.Click += (sender, args) => { Finish(); OverridePendingTransition(Resource.Animation.slide_in_down, Resource.Animation.slide_out_down); }; var answerButton = FindViewById<Button>(Resource.Id.button_answer); var labelHint = FindViewById<TextView>(Resource.Id.hint); var labelAwesome = FindViewById<TextView>(Resource.Id.awesome); var labelCongrats = FindViewById<TextView>(Resource.Id.congrats); labelHint.Text = QuestActivity.ViewModel.Quest.Question.Text; answerButton.Click += (sender, args) => { if (QuestActivity.ViewModel.QuestComplete) { Finish(); OverridePendingTransition(Resource.Animation.slide_in_down, Resource.Animation.slide_out_down); return; } messages.AskQuestions("Question:", QuestActivity.ViewModel.Quest.Question, (answer) => { QuestActivity.ViewModel.CheckAnswer(answer); if (QuestActivity.ViewModel.QuestComplete) { cancelButton.Visibility = ViewStates.Invisible; answerButton.SetText(Resource.String.continue_game); labelHint.SetText(Resource.String.continue_quest); labelAwesome.SetText(Resource.String.thats_it); labelCongrats.SetText(Resource.String.correct_answer); Settings.QuestDone = true; } }); }; var questNumber = FindViewById<TextView>(Resource.Id.text_quest_number); questNumber.Text = QuestActivity.ViewModel.CompletionDisplayShort; }
public ExpenseViewController(Expense expense) : base(UITableViewStyle.Plain, null, true) { this.expense = expense; dialog = ServiceContainer.Resolve<IMessageDialog>(); viewModel = ServiceContainer.Resolve<ExpenseViewModel>(); viewModel.Init(this.expense); viewModel.IsBusyChanged = (busy) => { if (busy) BTProgressHUD.Show("Saving..."); else BTProgressHUD.Dismiss(); }; }
private void Init() { dialog = ServiceContainer.Resolve<IMessageDialog>(); CanNavigate = true; if (currentExpense == null) { Name = string.Empty; Billable = true; Due = DateTime.Now; Notes = string.Empty; Total = string.Empty; Category = Categories[0]; Title = "New Expense"; return; } Name = currentExpense.Name; Notes = currentExpense.Notes; Due = currentExpense.Due; Billable = currentExpense.Billable; Total = currentExpense.Total; Category = currentExpense.Category; Title = "Edit Expense"; }
public CreditorService(IMessageDialog dialog, ILoggedInUserService l_user) { _dialog = dialog; m_logged_user = l_user.GetLoggedInUser(); }
internal override bool Resolve(IMessageDialog dialog, FilePackResult filePackResult) { // try parsing the new (or updated) addin manifests (configuration) var adnResolutions = TryParseAddins(dialog, filePackResult.AddinFilePacks); if (adnResolutions == null) { return(false); } var ctx = new ResolutionContext(); var addinCollision = new AddinCollision(); // try to register id of new addins at first, so that we can tell whether there are // any updated addins when registering that of the existing addins. foreach (var adnResolution in adnResolutions) { TryRegisterAddin(dialog, ctx, adnResolution, addinCollision); } // register all assets of existing addins to the context (skipping updated addins) List <AddinResolution> resolableAddins = null; if (_indexManager.AddinCount > 0) { resolableAddins = RegisterExistingAssets(dialog, ctx, addinCollision, adnResolutions); } // try to register assets of new and updated addins to the context foreach (var adnResolution in adnResolutions) { TryRegisterAssets(dialog, ctx, adnResolution, addinCollision); } if (resolableAddins != null) { adnResolutions.AddRange(resolableAddins); } // tries to resolve all addin, and make sure: // 1. there is no cirular dependencies between the resolved addins. // 2. the resolved addin list is sorted by the dependency. adnResolutions = TryResolveAddins(dialog, _convertionManager, ctx, adnResolutions); if (ResolutionFailed(dialog, ctx, adnResolutions)) { return(false); } // if there is any conflicting addins, trim them and all addins that depends on them. if (addinCollision.Count > 0) { TrimConflictingAddins(addinCollision, adnResolutions); if (ResolutionFailed(dialog, ctx, adnResolutions)) { return(false); } } // save all new and/or updated addin records to persistent file. PersistAddinRecords(ctx, adnResolutions); ctx.Dispose(); return(true); }
public ExpenseTypeFieldItemService(IMessageDialog dialog, ILoggedInUserService l_user) { _dialog = dialog; m_logged_user = l_user.GetLoggedInUser(); }
internal abstract bool TryParse(IMessageDialog dialog, AddinResolution addin, BaseExtensionPointResolution parent, out ExtensionBuilderResolution result);
public override void ViewDidLoad() { base.ViewDidLoad(); messages = ServiceContainer.Resolve<IMessageDialog>(); ButtonAnswer.Layer.CornerRadius = ButtonCancel.Layer.CornerRadius = 5; }
public ReplaceNextCommand(MainWindowViewModel callerViewModel, IMessageDialog messageDialog, IFindNextAndReplaceConditionsService findNextAndReplaceConditionsService) : base(callerViewModel) { _messageDialog = messageDialog; _findNextAndReplaceConditionsService = findNextAndReplaceConditionsService; }
public DimensionControlViewModel(IMessageDialog dialog) { Dialog = dialog; }
internal static bool InheritFromCompositeExtensionBuilderInterface( this ExtensionBuilderResolution eb, IMessageDialog dialog, ResolutionContext ctx, out TypeResolution extensionType) { return(eb.Type.ImplementsCompositeExtensionBuilderInterface(dialog, ctx, out extensionType)); }
/// <summary> /// The extension type of the extension builders must be the same as that of its parent. /// </summary> internal static bool ExtensionTypeMatchesParent(this ExtensionBuilderResolution eb, IMessageDialog dialog, TypeResolution extensionType) { var result = extensionType.Equals(eb.Parent.ExtensionType); // can not use ReferenceEquals here!!!! var parenteEb = eb.Parent as ExtensionBuilderResolution; if (!result) { dialog.AddError(string.Format( "The extension type of extension builder must match that of its parent, while the extension type of the extension builder [{0}] is [{1}], and that of its parent [{2}] is [{3}], which does not match!", eb.Path, extensionType.TypeName, parenteEb != null ? parenteEb.Path : eb.Parent.Id, eb.Parent.ExtensionType.TypeName)); } return(result); }
public GameCompleteViewModel() { messages = ServiceContainer.Resolve<IMessageDialog>(); }
public TargetGroupService(IMessageDialog dialog) { _dialog = dialog; _table_name = DbHelper.GetTableSchemaName(_table_name); }
internal abstract ResolutionStatus Resolve(IMessageDialog dialog, ConvertionManager convertionManager, ResolutionContext ctx);
// Constructor public ExpensePage() { InitializeComponent(); dialog = ServiceContainer.Resolve<IMessageDialog>(); }
// Constructor public ExpensePage() { InitializeComponent(); dialog = ServiceContainer.Resolve <IMessageDialog>(); }
public QuestViewModel() { messages = ServiceContainer.Resolve<IMessageDialog>(); }
public GoToLineWindowViewModel(IValidator <GoToLineWindowViewModel> validator, IMessageDialog messageDialog, IDocInfoService docInfoService) { _validator = validator; _messageDialog = messageDialog; _docInfoService = docInfoService; }
/// <summary> /// The extension builders used to build the current extension and the sibling extension (if exists) must be a child of that /// of the parent extension or extension point. /// </summary> internal static bool ExtensionBuildersMatchParent(this ExtensionResolution ex, IMessageDialog dialog) { return(ex.Sibling == null ? ExtensionBuilderMatchesParent(ex, dialog) : ExtensionBuilderMatchesParent(ex, dialog) && ExtensionBuilderMatchesParent(ex.Sibling, dialog)); }
public AddinOptions WithMessageDialog(IMessageDialog messageDialog) { _messageDialog = messageDialog; return(this); }
public ExpensesViewModel() { expenseService = ServiceContainer.Resolve<IExpenseService>(); messageDialog = ServiceContainer.Resolve<IMessageDialog>(); NeedsUpdate = true; }
// Notes that this method will load the related assembly which defined the IExtensionBuilder implementation into memory. /// <summary> /// The required properties of extension builder (marked by ExtensionDataAttribute) must be provided by the extension data. /// </summary> /// <returns></returns> internal static bool ExtensionDataMatchesExtensionBuilder(this ExtensionResolution ex, IMessageDialog dialog, ResolutionContext ctx, ConvertionManager convertionManager) { var ebProperties = ex.ExtensionBuilder.Type.GetSettableRuntimeProperties(); if (ebProperties == null) { return(true); } var data = ex.Data; foreach (var ebProp in ebProperties) { var propName = ebProp.Name; string propInput; if (!data.TryGetString(propName, out propInput)) { var exPropAttrib = ebProp.GetCustomAttribute <ExtensionPropertyAttribute>(false, false); if (exPropAttrib != null && exPropAttrib.Required) { dialog.AddError("a required property is missing!"); return(false); } continue; } #region specific types if (ebProp.PropertyType == typeof(string)) { var holder = new StringHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } // convert to TypeId if (ebProp.PropertyType == typeof(TypeId)) { TypeResolution type; // a type dependency is introduced here. // should it be added to the current addin's reference set? if (!ctx.TryGetAddinType(ex.DeclaringAddin, propInput, out type)) { dialog.AddError(""); return(false); } var holder = new LazyTypeIdHolder(type); data.AddSerializableHolder(propName, holder); continue; } #endregion // convert to custom type (with an ObjectConverter registered in ConvertionManager). var objectConverter = convertionManager.TryGet(typeof(string), ebProp.PropertyType); if (objectConverter == null) { dialog.AddError("No converter is registered for !"); return(false); } // if an property value is provided for the property name, try to convert it. object propValue; if (!objectConverter.TryConvert(propInput, out propValue)) { dialog.AddError("The string [] can not be converted to !"); return(false); } #region common types if (ebProp.PropertyType == typeof(Int32)) { var holder = new Int32Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Boolean)) { var holder = new BooleanHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Version)) { var holder = new VersionHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(DateTime)) { var holder = new DateTimeHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Guid)) { var holder = new GuidHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(TimeSpan)) { var holder = new TimeSpanHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Int64)) { var holder = new Int64Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(UInt64)) { var holder = new UInt64Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(UInt32)) { var holder = new UInt32Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Int16)) { var holder = new Int16Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(UInt16)) { var holder = new UInt16Holder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Byte)) { var holder = new ByteHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(SByte)) { var holder = new SByteHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Char)) { var holder = new CharHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Decimal)) { var holder = new DecimalHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Double)) { var holder = new DoubleHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } if (ebProp.PropertyType == typeof(Single)) { var holder = new SingleHolder(propInput); data.AddSerializableHolder(propName, holder); continue; } #endregion } return(true); }
/// <summary> /// The extension point type must implement the IExtensionPoint{TExtension, TRoot} interface (with 2 generic parameters). /// </summary> internal static bool InheritFromExtensionPointInterface( this ExtensionPointResolution ep, IMessageDialog dialog, ResolutionContext ctx, out TypeResolution extensionType) { return(ep.Type.ImplementsExtensionPointInterface(dialog, ctx, out extensionType)); }
public MeetupService() { messageDialog = IoC.Resolve <IMessageDialog>(); }