private void OpenInstanceExecute(object obj) { var cls = obj as NdfObjectViewModel; if (cls == null) { return; } var vm = new NdfClassViewModel(cls.Object.Class, this); NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == cls.Id); ViewModelBase baseViewModel; switch (cls.Object.Class.Name) { case "TGameplayArmeArmureContainer": case "TGameplayDamageResistanceContainer": baseViewModel = new ArmourDamageViewModel(inst.Object, this); break; default: if (inst == null) { return; } vm.InstancesCollectionView.MoveCurrentTo(inst); baseViewModel = vm; break; } DialogProvider.ProvideView(baseViewModel, this); }
public AndroidApplicationContext(BaseScreen baseActivity, Settings settings, Action loadComplete) { ApplicationBackground += () => { }; ApplicationRestore += () => { }; GlobalVariables = new Dictionary <string, object>(); _baseActivity = baseActivity; _settings = settings; _loadComplete = loadComplete; LocationProvider = new GpsProvider(_baseActivity); LocationTracker = new GpsTracker(_baseActivity); GalleryProvider = new GalleryProvider(_baseActivity, this); CameraProvider = new CameraProvider(_baseActivity, this); DialogProvider = new DialogProvider(_baseActivity, this); DisplayProvider = new DisplayProvider(); ClipboardProvider = new ClipboardProvider(_baseActivity); EmailProvider = new EmailProvider(_settings, _baseActivity); JokeProviderInternal = new JokeProvider(_baseActivity); LocalNotificationProvider = new LocalNotificationProvider(_baseActivity); WebProvider = new WebProvider(_baseActivity); var builder = new SolutionBuilder(this); builder.Build(); _commonData = ValueStackContext.Current.CreateCommonData("Android"); }
private void DeletePages(object param) { if (!CanDeletePages(param)) { return; } var list = ((IList)param).Cast <PageViewModel>().ToList(); var dialog = DialogProvider.CreateInteraction(); dialog.Content = DialogResources.PageCollectionViewer_DeleteDialogContent; dialog.Title = DialogResources.PageCollectionViewer_DeleteDialogTitle; dialog.ActionComplete += (sender, args) => { if (!args.IsAccept) { return; } Application.Current.Dispatcher.Invoke(() => { foreach (var page in list) { if (WindowViewModel.CurrentDocument.CanDeletePage) { WindowViewModel.CurrentDocument.Pages.Remove(page); } } }); }; dialog.ShowInteraction(); }
public static Task ShowMenuCommandWatcher( AutoResetEvent autoResetEvent, DialogProvider dialogProvider, Menu <MenuAction> menu, PaintBrush brush) { return(Task.Run(() => { do { if (!Console.KeyAvailable) { Thread.Sleep(100); continue; } var key = Console.ReadKey(false).Key; switch ((int)key) { case (int)MenuAction.ServiceStart: Action = MenuAction.ServiceStart; break; case (int)MenuAction.ServiceStop: Action = MenuAction.ServiceStop; break; case (int)MenuAction.ServicePause: Action = MenuAction.ServicePause; break; case (int)MenuAction.ServiceContinue: Action = MenuAction.ServiceContinue; break; case (int)MenuAction.ServiceShutdown: Action = MenuAction.ServiceShutdown; break; case (int)MenuAction.Exit: Action = MenuAction.Exit; break; case (int)ConsoleKey.F1: lock (ConsoleGuardian) { Console.WriteLine("\n" + menu); } continue; default: continue; } autoResetEvent.Set(); } while (Action != MenuAction.Exit); })); }
protected override async void OnResume() { base.OnResume(); try { Car car = await HttpManager.HttpGet <Car>(String.Format(HttpManager.GetHostAddress() + "/cars/{0}", _carId)); _brandDetail.Text = car.Brand; _typeDetail.Text = car.Type; _stateDetail.Text = CarStateManager.ConvertCarStateFromDatabaseValue(car.State); _kilometersDetail.Text = String.Format("{0}km", car.Kilometers); _powerDetail.Text = String.Format("{0}kW", car.Power); _torqueDetail.Text = String.Format("{0}Nm", car.Torque); _priceDetail.Text = String.Format("{0}€", car.Price); Bitmap bmp = null; await Task.Run(() => { bmp = BitmapDownloader.GetImageBitmapFromUrl(car.Picture); }); _pictureZoom.SetImageBitmap(bmp); } catch (WebException e) { DialogProvider.ShowOkDialogWithoutAction(this, "Connection lost!", "Connection", (sender, args) => { Finish(); }); } }
public IOSApplicationContext(AppDelegate appDelegate, NavigationController controller, ApplicationSettings settings, CustomExceptionHandler exceptionHandler) { ApplicationBackground += () => { }; ApplicationRestore += () => { }; GlobalVariables = new Dictionary<string, object>(); Settings = settings; _controller = controller; _exceptionHandler = exceptionHandler; LocationProvider = new GpsProvider (); LocationTracker = new GPSTracker(); GalleryProvider = new GalleryProvider(controller, this); CameraProvider = new CameraProvider(controller, this); DialogProvider = new DialogProvider(this); DisplayProvider = new DisplayProvider(); ClipboardProvider = new ClipboardProvider(); EmailProvider = new EmailProvider(settings, appDelegate); JokeProviderInternal = new JokeProvider(); LocalNotificationProvider = new LocalNotificationProvider(); WebProvider = new WebProvider(); var builder = new SolutionBuilder(this); builder.Build(); StyleSheetContext.Current.Scale = UIScreen.MainScreen.Scale; }
private void CopyInstanceExecute(object obj) { var cls = ClassesCollectionView.CurrentItem as NdfClassViewModel; if (cls == null) { return; } var inst = cls.InstancesCollectionView.CurrentItem as NdfObjectViewModel; if (inst == null) { return; } if (!inst.Object.IsTopObject) { MessageBox.Show("You can only create a copy of an top object.", "Information", MessageBoxButton.OK); return; } _copyInstanceResults = new List <NdfObject>(); CopyInstance(inst.Object); var resultViewModel = new ObjectCopyResultViewModel(_copyInstanceResults, this); DialogProvider.ProvideView(resultViewModel, this); }
public AndroidApplicationContext(BaseScreen baseActivity, Settings settings, Action loadComplete) { ApplicationBackground += () => { }; ApplicationRestore += () => { }; GlobalVariables = new Dictionary<string, object>(); _baseActivity = baseActivity; _settings = settings; _loadComplete = loadComplete; LocationProvider = new GpsProvider(_baseActivity); LocationTracker = new GpsTracker(_baseActivity); GalleryProvider = new GalleryProvider(_baseActivity, this); CameraProvider = new CameraProvider(_baseActivity, this); DialogProvider = new DialogProvider(_baseActivity, this); DisplayProvider = new DisplayProvider(); ClipboardProvider = new ClipboardProvider(_baseActivity); EmailProvider = new EmailProvider(_settings, _baseActivity); JokeProviderInternal = new JokeProvider(_baseActivity); LocalNotificationProvider = new LocalNotificationProvider(_baseActivity); WebProvider = new WebProvider(_baseActivity); var builder = new SolutionBuilder(this); builder.Build(); _commonData = ValueStackContext.Current.CreateCommonData("Android"); }
void InteractDialogProvider(Collider2D other) { DialogProvider dialogProvider = other.GetComponent <DialogProvider>(); if (dialogProvider != null) { dialogProvider.DisplayDialog(); } }
public AppCommands( IUnityContainer container, DialogProvider dialogProvider) { container.RegisterInstance(this); _container = container; _dialogProvider = dialogProvider; _mainViewModel = new Lazy <MainViewModel>(() => container.Resolve <MainViewModel>()); }
/// <summary> /// Save the specified document as a new file, allowing the user to specify the new filepath. /// </summary> public void SaveFileAs(TextFileDocumentViewModel document) { string newFilePath = null; if (DialogProvider.UserSelectsNewFilePath(document.FilePath, out newFilePath)) { SaveFile(document, newFilePath); } }
/// <summary> /// Allow the user to select a particular file then open it. /// </summary> public void OpenFile() { string filePath = null; if (DialogProvider.UserSelectsFileToOpen(out filePath)) { OpenFile(filePath); } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected virtual void OnDialogOpened(RoutedEventArgs e) { DialogOpened?.Invoke(this, e); string[] Paths; if (DialogProvider.Show(out Paths, BrowseTitle, BrowseMode, DialogProviderSelectionMode.Single, null, Text)) { Text = Paths[0]; } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mainVm = new EdataManagerViewModel(); DialogProvider.ProvideView(mainVm); //var versionVm = new VersionManagerViewModel(mainVm); //DialogProvider.ProvideView(versionVm); }
private void FollowList(IValueHolder prop) { var refe = prop.Value as NdfCollection; if (refe == null) { return; } var editor = new ListEditorViewModel(refe, NdfbinManager); DialogProvider.ProvideView(editor, this); }
public SettingsViewModel(IAppService appService) { AppService = appService; LoadSettings(appService.AppSettings); ClearStatistic = new Command( execute: async() => { var displayAlert = new DialogProvider(Page); var changeTask = await displayAlert.DisplayAlert("Clear Task Statistics", "All statistics about finished task will be deleted. Did you want to continue.", "ok", "cancel"); if (!changeTask) { return; } AppService.ClearStatistics(); } ); Save = new Command( execute: async() => { var settings = this.CreatePomodoroSettings(); if (settings != null) { IsBusy = true; var isSaved = await AppService.SaveSettingsAsync(settings); if (isSaved) { var notificator = DependencyService.Get <INotification>(); notificator.Show("Saved."); } IsBusy = false; } } ); LoadDefault = new Command( execute: async() => { var settings = AppConstants.DEFAULT_APP_SETTINGS; if (settings != null) { this.IsBusy = true; await AppService.SaveSettingsAsync(settings); this.LoadSettings(settings); this.IsBusy = false; } } ); }
private void FindAllReferencesExecute(object obj) { var cls = ClassesCollectionView.CurrentItem as NdfClassViewModel; if (cls == null) { return; } var inst = cls.InstancesCollectionView.CurrentItem as NdfObjectViewModel; if (inst == null) { return; } var result = new List <NdfPropertyValue>(); Dispatcher dispatcher = Dispatcher.CurrentDispatcher; Action <string> report = msg => StatusText = msg; var s = new Task(() => { try { //dispatcher.Invoke(() => IsUIBusy = true); dispatcher.Invoke(report, string.Format("Searching for references...")); foreach (var instance in NdfBinary.Instances) { foreach (var propertyValue in instance.PropertyValues) { GetValue(propertyValue, inst, result, propertyValue); } } var resultVm = new ReferenceSearchResultViewModel(result, this); dispatcher.Invoke(() => DialogProvider.ProvideView(resultVm, this)); dispatcher.Invoke(report, string.Format("{0} references found", result.Count)); } catch (Exception ex) { Trace.TraceError(string.Format("Error while saving Ndfbin file: {0}", ex)); dispatcher.Invoke(report, "Error while searching"); } }); s.Start(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Detail); _carId = Intent.GetLongExtra(CarIdExtras, 0); _backButton = FindViewById <Button>(Resource.Id.BackButton); _editButton = FindViewById <Button>(Resource.Id.EditButton); _brandDetail = FindViewById <TextView>(Resource.Id.BrandDetail); _typeDetail = FindViewById <TextView>(Resource.Id.TypeDetail); _stateDetail = FindViewById <TextView>(Resource.Id.StateDetail); _kilometersDetail = FindViewById <TextView>(Resource.Id.KilometersDetail); _powerDetail = FindViewById <TextView>(Resource.Id.PowerDetail); _torqueDetail = FindViewById <TextView>(Resource.Id.TorqueDetail); _pictureZoom = FindViewById <ImageView>(Resource.Id.PictureZoom); _priceDetail = FindViewById <TextView>(Resource.Id.PriceDetail); _buyButton = FindViewById <Button>(Resource.Id.BuyButton); _backButton.Click += (sender, args) => { Finish(); }; _editButton.Click += (sender, args) => { EditActivity.StartActivity(this, _carId); }; _pictureZoom.Click += (sender, args) => { ZoomActivity.StartActivity(this, _carId); }; _buyButton.Click += async(sender, args) => { try { await HttpManager.HttpDelete(HttpManager.GetHostAddress() + "/cars/" + _carId); DialogProvider.ShowOkDialogWithoutAction(this, "You buy this car. Thanks for your purchase!", "Congratulation!", (o, eventArgs) => { Finish(); }); } catch (WebException e) { DialogProvider.ShowOkDialogWithoutAction(this, "Connection lost!", "Connection", null); } }; }
/// <summary> /// Open a file, create a view-model and it to the collection of document view-models. /// </summary> public void OpenFile(string filePath) { try { var fileContent = File.ReadAllText(filePath); var newDocumentViewModel = new TextFileDocumentViewModel(filePath, fileContent, false); this.Documents.Add(newDocumentViewModel); } catch (Exception ex) { DialogProvider.ErrorMessage("Failed to open document " + filePath + "\n" + "Exception occurred:\n" + ex.ToString()); } }
public void Dispose() { var app = AvaloniaApp.GetApp(); var dialogs = new Window[] { DialogProvider.GetDialog <CreateDirectoryDialog>(app) }; dialogs.ForEach(d => d?.Close()); if (!string.IsNullOrEmpty(_directoryFullPath) && Directory.Exists(_directoryFullPath)) { Directory.Delete(_directoryFullPath, true); } }
public void Dispose() { var app = AvaloniaApp.GetApp(); var dialogs = new Window[] { DialogProvider.GetDialog <RemoveNodesConfirmationDialog>(app) }; dialogs.ForEach(d => d?.Close()); if (!string.IsNullOrEmpty(_fileFullPath) && File.Exists(_fileFullPath)) { File.Delete(_fileFullPath); } }
protected override bool OnBackButtonPressed() { try { bool exitapp = true;; var previous = PageProvider.GetPrevious(); if (previous == null) { if (AppMainService.Instance.PomodoroStatus?.TimerState == Enums.TimerState.Running) { Device.BeginInvokeOnMainThread(async() => { var displayAlert = new DialogProvider(Detail); var cancelRunnigTimer = await displayAlert.DisplayAlert("Cancel Timer", "Running timer will be stopped. Do you want to continue ?", "ok", "cancel"); if (cancelRunnigTimer) { AppMainService.Instance.StopPomodoro(); exitapp = true; } else { exitapp = false; } if (exitapp) { OnBackButtonPressed(); } }); return(true); } else { base.OnBackButtonPressed(); return(false); } } else { Detail = previous; return(true); } } catch (Exception ex) { Debug.Fail(ex.Message); return(true); } }
/// <summary> /// Save the specified document to the specified filepath. /// </summary> public void SaveFile(TextFileDocumentViewModel document, string newFilePath) { try { File.WriteAllText(newFilePath, document.Text); document.FilePath = newFilePath; document.IsModified = false; } catch (Exception ex) { DialogProvider.ErrorMessage("Failed to save document " + newFilePath + "\n" + "Exception occurred: \n" + ex.ToString()); } }
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { e.Handled = true; var vm = new UnhandledExceptionViewModel(e.Exception); DialogProvider.ProvideView(vm); var excep = e.Exception; while (excep != null) { Trace.TraceError("Unhandeled exception occoured: {0}", e.Exception); excep = excep.InnerException; } }
public ApplicationContext (NavigationController controller, BitMobile.Application.ApplicationSettings settings, CustomExceptionHandler exceptionHandler) { GlobalVariables = new Dictionary<string, object> (); BitMobile.Application.ApplicationContext.InitContext (this); this.Settings = settings; this._controller = controller; this._exceptionHandler = exceptionHandler; LocationProvider = new GPSProvider (); LocationTracker = new GPSTracker (); GalleryProvider = new GalleryProvider (controller, this); CameraProvider = new CameraProvider (controller, this); DialogProvider = new DialogProvider (this); ClipboardProvider = new ClipboardProvider (); }
private async void DeleteItem(object item) { var displayAlert = new DialogProvider(Page); var changeTask = await displayAlert.DisplayAlert("Delete Task", "Task will be deleted. Did you want to continue.", "ok", "cancel"); if (!changeTask) { return; } var deletedTask = item as UserTask; var result = await AppService.RemoveUserTask(deletedTask); if (result) { UserTasks.Remove(deletedTask); } }
protected override async void OnResume() { base.OnResume(); try { Car car = await HttpManager.HttpGet <Car>(String.Format(HttpManager.GetHostAddress() + "/cars/{0}", _carId)); Bitmap bmp = null; await Task.Run(() => { bmp = BitmapDownloader.GetImageBitmapFromUrl(car.Picture); }); _picture.SetImageBitmap(bmp); } catch (WebException e) { DialogProvider.ShowOkDialogWithoutAction(this, "Connection lost!", "Connection", (sender, args) => { Finish(); }); } }
protected void EditTradFileExecute(object obj) { var vm = CollectionViewSource.GetDefaultView(OpenFiles).CurrentItem as EdataFileViewModel; if (vm == null) { return; } var ndf = vm.FilesCollectionView.CurrentItem as EdataContentFile; if (ndf == null) { return; } var tradVm = new TradFileViewModel(ndf, vm); DialogProvider.ProvideView(tradVm, this); }
public ApplicationContext (NavigationController controller, BitMobile.Application.ApplicationSettings settings, CustomExceptionHandler exceptionHandler) { GlobalVariables = new Dictionary<string, object> (); Settings = settings; _controller = controller; _exceptionHandler = exceptionHandler; LocationProvider = new GPSProvider (); LocationTracker = new GPSTracker (); GalleryProvider = new GalleryProvider (controller, this); CameraProvider = new CameraProvider (controller, this); DialogProvider = new DialogProvider (this); DisplayProvider = new DisplayProvider (); var builder = new SolutionBuilder (this); builder.Build (); StyleSheetContext.Current.Scale = UIScreen.MainScreen.Scale; }
private void FollowList(IValueHolder prop) { var refe = prop.Value as NdfCollection; if (refe == null) { return; } if (isTable(refe)) { var editor = new ListEditorViewModel(refe, Object.Class.Manager); DialogProvider.ProvideView(editor, ParentVm); } else { var editor = new ListEditorViewModel(refe, Object.Class.Manager); DialogProvider.ProvideView(editor, ParentVm); } }
public ApplicationContext(BaseScreen baseActivity, Settings settings, System.Action loadComplete) { GlobalVariables = new Dictionary<string, object>(); _baseActivity = baseActivity; _settings = settings; _loadComplete = loadComplete; LocationProvider = new GpsProvider(baseActivity); LocationTracker = new GPSTracker(baseActivity); GalleryProvider = new GalleryProvider(baseActivity); CameraProvider = new CameraProvider(baseActivity, this); DialogProvider = new DialogProvider(baseActivity, this); ClipboardProvider = new ClipboardProvider(baseActivity, this); Application.ApplicationContext.InitContext(this); }
public ApplicationContext(BaseScreen baseActivity, Settings settings, System.Action loadComplete) { GlobalVariables = new Dictionary <string, object>(); _baseActivity = baseActivity; _settings = settings; _loadComplete = loadComplete; LocationProvider = new GpsProvider(baseActivity); LocationTracker = new GPSTracker(baseActivity); GalleryProvider = new GalleryProvider(baseActivity); CameraProvider = new CameraProvider(baseActivity, this); DialogProvider = new DialogProvider(baseActivity, this); ClipboardProvider = new ClipboardProvider(baseActivity, this); Application.ApplicationContext.InitContext(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LoginScreen); _username = FindViewById <EditText>(Resource.Id.Username); _password = FindViewById <EditText>(Resource.Id.Password); _loginButton = FindViewById <Button>(Resource.Id.LoginButton); _loginButton.Click += (sender, args) => { if (_username.Text == "FerkoUzasny" && _password.Text == "FerkoUzasny") { StartActivity(typeof(ListActivity)); } else { DialogProvider.ShowOkDialogWithoutAction(this, "Username or password is incorrect!", "Error", null); } }; }
private void DetailsExecute(object obj) { var propVal = obj as NdfPropertyValue; if (propVal == null) { return; } var vm = new NdfClassViewModel(propVal.Instance.Class, this); NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == propVal.Instance.Id); if (inst == null) { return; } vm.InstancesCollectionView.MoveCurrentTo(inst); DialogProvider.ProvideView(vm, Editor); }
private void FollowObjectReference(IValueHolder prop) { var refe = prop.Value as NdfObjectReference; if (refe == null) { return; } var vm = new NdfClassViewModel(refe.Class, ParentVm); NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == refe.InstanceId); if (inst == null) { return; } vm.InstancesCollectionView.MoveCurrentTo(inst); DialogProvider.ProvideView(vm, ParentVm); }