Beispiel #1
0
    /// <summary>
    /// Assign current actions to the Buttons
    /// </summary>
    /// <param name="userInteraction"></param>
    private void assignActions(IUserInteraction userInteraction)
    {
        selectedObject = userInteraction;
        if (selectedObject == null)
        {
            Clear(); return;
        }


        actions = selectedObject.getAvailableActions();

        int index = 0;

        foreach (Button button in buttons)
        {
            if (index < actions.Count)
            {
                button.gameObject.SetActive(true);
                button.GetComponentInChildren <Text>().text = actions[index];
            }
            else
            {
                button.gameObject.SetActive(false);
            }

            index++;
        }
    }
        public FlickrSource(IMetadataStore store, IPlacelessconfig configuration, IUserInteraction userInteraction)
        {
            _metadataStore   = store;
            _configuration   = configuration;
            _userInteraction = userInteraction;
            _flickr          = new FlickrNet.Flickr(API_KEY, API_SECRET);
            _flickr.InstanceCacheDisabled = true;
            var token  = _configuration.GetValue(TOKEN_PATH);
            var secret = _configuration.GetValue(SECRET_PATH);

            token  = "";
            secret = "";

            if (string.IsNullOrWhiteSpace(token) || string.IsNullOrWhiteSpace(secret))
            {
                var    requestToken = _flickr.OAuthGetRequestToken("oob");
                string url          = _flickr.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Write);
                _userInteraction.OpenWebPage(url);
                string approvalCode = _userInteraction.InputPrompt("Please approve access to your Flickr account and enter the key here:");

                var accessToken = _flickr.OAuthGetAccessToken(requestToken, approvalCode);
                token  = accessToken.Token;
                secret = accessToken.TokenSecret;
                _configuration.SetValue(TOKEN_PATH, token);
                _configuration.SetValue(SECRET_PATH, secret);
            }
            _flickr.OAuthAccessToken       = token;
            _flickr.OAuthAccessTokenSecret = secret;
        }
 public EditFilterBindingsViewModel(
     IConfigurationManager configManager,
     IUserInteraction userInteraction)
 {
     _userInteraction = userInteraction;
     _configManager   = configManager;
 }
 public WeatherInformation GetInformation(IUserInteraction userInteraction, DateTime date, double latitude, double longitude)
 {
     return(new WeatherInformation(
                date.Date.AddHours(startTime),
                date.Date.AddHours(endTime + 12),
                Enumerable.Empty <WeatherReading>()));
 }
Beispiel #5
0
        public MainWindowViewModel(ItemRepository itemRepository, IUserInteraction userInteraction)
        {
            _itemRepository  = itemRepository;
            _userInteraction = userInteraction;

            Title = "This is a title";

            LoadItemsCommand = new RelayCommand(_ =>
            {
                var items          = _itemRepository.GetItems();                    // this returns the models! // we have to wrap them by a viewmodel
                var itemViewModels = items.Select(item => new ItemViewModel(item)); // no we wrapped them in a viewmodel
                Items.Clear();
                foreach (var itemViewModel in itemViewModels)
                {
                    Items.Add(itemViewModel);
                }
            });

            ClearItemsCommand = new RelayCommand(_ =>
            {
                const string title  = "Items will be deleted";
                const string prompt = "Are you shure that you want to delete the item?";
                var result          = _userInteraction.DisplayAlert(title, prompt);
                if (result == UserInteractionResult.OK || result == UserInteractionResult.Yes)
                {
                    Items.Clear();
                }
            });
        }
Beispiel #6
0
        private int runCount = 0; // number of times run has been called

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Bot"/> class.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="userInteraction">The user interaction manager..</param>
        /// <param name="console">The console.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="listener">The listener.</param>
        /// <param name="pluginHandler">The plugin handler.</param>
        /// <param name="moduleLoader">The module loader.</param>
        /// <param name="authorization">The authorization manager.</param>
        public Bot(
            Client client, 
            IUserInteraction userInteraction, 
            IConsole console, 
            IBotSettings settings, 
            IListener listener, 
            IPluginHandler pluginHandler,
            IModuleLoader moduleLoader,
            IAuthorization authorization)
        {
            Guard.Against(client.IsNull(), "client");
            Guard.Against(userInteraction.IsNull(), "userInteraction");
            Guard.Against(console.IsNull(), "console");
            Guard.Against(settings.IsNull(), "settings");
            Guard.Against(listener.IsNull(), "listener");
            Guard.Against(pluginHandler.IsNull(), "pluginHandler");
            Guard.Against(moduleLoader.IsNull(), "moduleLoader");
            Guard.Against(authorization.IsNull(), "authorization");

            this.client = client;
            this.userInteraction = userInteraction;
            this.console = console;
            this.settings = settings;
            this.listener = listener;
            this.pluginHandler = pluginHandler;
            this.moduleLoader = moduleLoader;
            this.authorization = authorization;
            this.SessionStart = DateTime.Now;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <param name="players"></param>
 /// <param name="moves"></param>
 /// <param name="interactionController"></param>
 public Game(int id, List <IPlayer> players, List <IMove> moves, IUserInteraction interactionController)
 {
     Id           = id;
     Participants = players;
     Moves        = moves;
     Controller   = interactionController;
 }
Beispiel #8
0
 /// <summary>
 /// Initialize the dependencies
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="userInteraction"></param>
 /// <param name="CargoRocketWarehouse"></param>
 public static void InitializeDashboard(IHelper helper, IUserInteraction userInteraction,
                                        INextGenCargoRocketWarehouse CargoRocketWarehouse)
 {
     _helper               = helper;
     _userInteraction      = userInteraction;
     _cargoRocketWarehouse = CargoRocketWarehouse;
 }
Beispiel #9
0
        public SettingsViewModel(
            IApplicationSettingServiceSingleton applicationSettingService,
            IMvxMessenger messenger, IUserInteraction userInteraction)
        {
            if (applicationSettingService == null)
            {
                throw new ArgumentNullException("applicationSettingService");
            }

            if (messenger == null)
            {
                throw new ArgumentNullException("messenger");
            }

            if (userInteraction == null)
            {
                throw new ArgumentNullException("userInteraction");
            }

            _applicationSettingService = applicationSettingService;
            _messenger       = messenger;
            _userInteraction = userInteraction;

            this.InitializeCommands();
            this.InitializeActions();
        }
        public SettingsViewModel(
            IApplicationSettingServiceSingleton applicationSettingService, 
            IMvxMessenger messenger,IUserInteraction userInteraction)
        {
            
            if (applicationSettingService == null)
            {
                throw new ArgumentNullException("applicationSettingService");
            }

            if (messenger == null)
            {
                throw new ArgumentNullException("messenger");
            }

            if (userInteraction == null)
            {
                throw new ArgumentNullException("userInteraction");
            }

            _applicationSettingService = applicationSettingService;
            _messenger = messenger;
            _userInteraction = userInteraction;

            this.InitializeCommands();
            this.InitializeActions();
        }
Beispiel #11
0
 public Registration(IEnumerable <IProtocolRegistrar> registrars, IUserInteraction userInteraction,
                     IOsServices osServices)
 {
     Registrars      = registrars;
     UserInteraction = userInteraction;
     OsServices      = osServices;
 }
Beispiel #12
0
 public PrinterViewModel(IPrinterService printerService, IUserInteraction userInteraction)
 {
     _printerService  = printerService;
     _userInteraction = userInteraction;
     EditCustomPrinterSettingsCommand = new CaptionCommand <string>(Resources.Settings,
                                                                    OnEditCustomPrinterSettings, CanEditCustomPrinterSettings);
 }
Beispiel #13
0
        public WeatherInformation GetInformation(IUserInteraction userInteraction, DateTime date, double latitude, double longitude)
        {
            string address = $"https://api.sunrise-sunset.org/json?lng={longitude}&lat={latitude}&date={date.ToString("yyyy-MM-dd")}";

            userInteraction.Log($"Requesting sunrise/set from {address}");

            using (var response = WebRequest.CreateHttp(address).GetResponse())
            {
                using (var responseStream = response.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(responseStream))
                    {
                        string json = reader.ReadToEnd();

                        JObject parsedJson  = JObject.Parse(json);
                        string  sunriseText = (string)parsedJson["results"]?["sunrise"];
                        string  sunsetText  = (string)parsedJson["results"]?["sunset"];

                        if (ParseSunTime(date, sunriseText, out DateTime sunrise) &&
                            ParseSunTime(date, sunsetText, out DateTime sunset))
                        {
                            userInteraction.Log($"Retrieved sunrise/set from {address}");
                            return(new WeatherInformation(sunrise, sunset, Enumerable.Empty <WeatherReading>()));
                        }
                        else
                        {
                            userInteraction.Log($"Could not retrieve1 sunrise/set from {address}");
                            return(null);
                        }
                    }
                }
            }
        }
        public AddIngredientPageViewModel(
            IIngredientsRepository ingredientsRepository,
            INavigationService navigationService,
            IUserInteraction userInteraction,
            ICrossMediaService crossMediaService)
            : base(navigationService, userInteraction, crossMediaService)
        {
            DrinkIngredientViewModel = new DrinkIngredientViewModel(new Ingredient());

            AcceptCommand = ReactiveCommand.CreateFromTask(async _ =>
            {
                if (!await IsInputValidAsync())
                {
                    return;
                }

                DrinkIngredientViewModel.Name        = IngredientName;
                DrinkIngredientViewModel.ByteImage   = IngredientImage;
                DrinkIngredientViewModel.BottleIndex = BottleIndex;

                DrinkIngredientViewModel.UpdateIngredientModel();

                await ingredientsRepository.InsertAsync(DrinkIngredientViewModel.Ingredient);
                await navigationService.PopAsync();
            });
        }
        public BluetoothPageViewModel(IBluetoothService bluetoothService, INavigationService navigationService, IUserInteraction userInteraction)
        {
            _bluetoothService  = bluetoothService;
            _navigationService = navigationService;
            _userInteraction   = userInteraction;

            SendCommand = ReactiveCommand.Create(async() => await _bluetoothService.WriteAsync("Test"));
        }
Beispiel #16
0
 /// <summary>
 /// Constructs a new instance of a MapWin interface where the Map, Legend, Form and MenuStrip
 /// are all specified.
 /// </summary>
 /// <param name="inMap">Any valid implementation of IBasicMap</param>
 /// <param name="inLegend">Any valid implementation of ILegend</param>
 /// <param name="inMainForm">Any valid windows Form</param>
 /// <param name="inMenuStrip">Any valid windows MenuStrip</param>
 public MapWin(IBasicMap inMap, ILegend inLegend, Form inMainForm, MenuStrip inMenuStrip)
 {
     _map             = inMap;
     _legend          = inLegend;
     _mainForm        = inMainForm;
     _menuStrip       = inMenuStrip;
     _userInteraction = new UserInteraction();
 }
Beispiel #17
0
 /// <summary>
 /// Constructs a new instance of a MapWin interface where the Map, Legend, Form and MenuStrip
 /// are all specified.
 /// </summary>
 /// <param name="inMap">Any valid implementation of IBasicMap</param>
 /// <param name="inLegend">Any valid implementation of ILegend</param>
 /// <param name="inMainForm">Any valid windows Form</param>
 /// <param name="inMenuStrip">Any valid windows MenuStrip</param>
 public MapWin(IBasicMap inMap, ILegend inLegend, Form inMainForm, MenuStrip inMenuStrip)
 {
     _map = inMap;
     _legend = inLegend;
     _mainForm = inMainForm;
     _menuStrip = inMenuStrip;
     _userInteraction = new UserInteraction();
 }
 public static void AssignInteractionType(Type t)
 {
     if (typeof(IUserInteraction).IsAssignableFrom(t))
     {
         ConstructorInfo ci = t.GetConstructor(new Type[] { });
         userInteraction = (IUserInteraction)ci.Invoke(new Object[] { });
     }
 }
 public TicketTagGroupViewModel(IUserInteraction userInteraction)
 {
     _userInteraction       = userInteraction;
     AddTicketTagCommand    = new CaptionCommand <string>(string.Format(Resources.Add_f, Resources.Tag), OnAddTicketTagExecuted);
     DeleteTicketTagCommand = new CaptionCommand <string>(string.Format(Resources.Delete_f, Resources.Tag), OnDeleteTicketTagExecuted, CanDeleteTicketTag);
     SortTicketTagsCommand  = new CaptionCommand <string>(string.Format(Resources.Sort_f, Resources.Tag),
                                                          OnSortTicketTags, CanSortTicketTags);
 }
Beispiel #20
0
 public BufermanOptionsWindowFactory(IProgramSettingsGetter settingsGetter,
                                     IProgramSettingsSetter settingsSetter,
                                     IUserInteraction userInteraction)
 {
     this._settingsGetter  = settingsGetter;
     this._settingsSetter  = settingsSetter;
     this._userInteraction = userInteraction;
 }
 public CameraViewModel(IPermissionsService permissionsService
                        , ICarnetService carnetService
                        , IUserInteraction userInteraction)
 {
     this.userInteraction    = userInteraction;
     this.carnetService      = carnetService;
     this.permissionsService = permissionsService;
     CaptureCommand          = new MvxAsyncCommand <byte[]>(Capture);
 }
Beispiel #22
0
 public ConsoleManager(IConsoleWriter writer, IConsoleReader reader, IConsoleCleaner cleaner,
                       IUserInteraction userInteraction, IQuestionAction questionAction)
 {
     Writer          = writer;
     Reader          = reader;
     Cleaner         = cleaner;
     UserInteraction = userInteraction;
     QuestionAction  = questionAction;
 }
Beispiel #23
0
 public VehicleDetailViewModel(IMyShuttleClient myShuttleClient,
                               IMvxPhoneCallTask phoneCallTask,
                               IUserInteraction userInteraction,
                               ILocationServiceSingleton locationService,
                               IApplicationSettingServiceSingleton applicationSettingService) : base(myShuttleClient,
                                                                                                     phoneCallTask, userInteraction, locationService, applicationSettingService)
 {
     this.InitializeCommands();
 }
 public ManageFilterBindingsViewModel(
     IConfigurationManager configManager,
     IUserInteraction userInteraction,
     EditFilterBindingsViewModel editFilterBindingsViewModel)
 {
     _editFilterBindingsViewModel = editFilterBindingsViewModel;
     _userInteraction             = userInteraction;
     _configManager = configManager;
 }
Beispiel #25
0
 public Engine(IPresenter presenter, IUserInteraction userInteraction)
 {
     this.Presenter       = presenter;
     this.UserInteraction = userInteraction;
     this.Machine         = new Machine();
     this.Player          = new Player();
     this.symbolBag       = new List <char>();
     this.gameHistory     = new List <Tuple <decimal, decimal> >();
 }
Beispiel #26
0
        public CommandCentre(IHelper helper, IUserInteraction userInteraction,
                             INextGenCargoRocketWarehouse CargoRocketWarehouse)
        {
            _helper               = helper;
            _userInteraction      = userInteraction;
            _cargoRocketWarehouse = CargoRocketWarehouse;

            Dashboard.InitializeDashboard(_helper, _userInteraction, _cargoRocketWarehouse);
        }
Beispiel #27
0
 public Collector(IMetadataStore metadataStore, T source, IUserInteraction userInteraction)
 {
     _metadataStore   = metadataStore;
     _source          = source;
     _sourceName      = source.GetName();
     _roots           = new ConcurrentQueue <string>();
     _files           = new ConcurrentQueue <DiscoveredFile>();
     _userInteraction = userInteraction;
 }
Beispiel #28
0
        /// <summary>
        /// Initializes a new instance of the Appliaction class
        /// </summary>
        /// <exception cref="ArgumentNullException">userInteraction is null</exception>
        internal Appliaction(IUserInteraction userInteraction)
        {
            if (userInteraction == null)
            {
                throw new ArgumentNullException(nameof(userInteraction));
            }

            _userInteraction = userInteraction;
        }
        /// <summary>Fires the Raised event.</summary>
        /// <param name="context">The context for the interaction request.</param>
        /// <param name="callback">The callback to execute when the interaction is completed.</param>
        public void Raise(IUserInteraction context, Action <IUserInteraction> callback)
        {
            EventHandler <UserInteractionRequestedEventArgs> eventHandler = Raised;

            eventHandler?.Invoke(this, new UserInteractionRequestedEventArgs(context, () =>
            {
                callback?.Invoke(context);
            }));
        }
 public VehicleDetailViewModel(IMyShuttleClient myShuttleClient,
     IMvxPhoneCallTask phoneCallTask,
     IUserInteraction userInteraction,
     ILocationServiceSingleton locationService,
     IApplicationSettingServiceSingleton applicationSettingService) : base(myShuttleClient,
         phoneCallTask, userInteraction, locationService, applicationSettingService)
 {
     this.InitializeCommands();
 }
            public WeatherInformation GetInformation(IUserInteraction userInteraction, DateTime date, double latitude, double longitude)
            {
                WeatherInformation start = this.startTime.GetInformation(userInteraction, date, latitude, longitude);
                WeatherInformation end   = this.endTime.GetInformation(userInteraction, date, latitude, longitude);

                return(new WeatherInformation(
                           start.StartTime,
                           end.EndTime,
                           Enumerable.Empty <WeatherReading>()));
            }
Beispiel #32
0
        public static void OnErrorHandle(this Task t, IUserInteraction ui, CancellationToken token, TaskScheduler scheduler = null)
        {
            var s = scheduler ?? TaskScheduler.Current;

            t.ContinueWith(r =>
            {
                ui.Logger.Error(r.Exception);
                ui.HandleError(r.Exception);
            }, token, TaskContinuationOptions.OnlyOnFaulted, s);
        }
 /// <summary>
 ///  Constructor injecting in the Match instance dependancies
 /// </summary>
 /// <param name="id"></param>
 /// <param name="players"></param>
 /// <param name="numGames"></param>
 /// <param name="score"></param>
 /// <param name="interactionController"></param>
 /// <param name="gameResults"></param>
 /// <param name="rounds"></param>
 public Match(int id, List <IPlayer> players, int numGames, IScore score, IUserInteraction interactionController, List <IContestResult> gameResults, List <Contest> rounds)
 {
     Id           = id;
     Participants = players;
     NumRounds    = numGames;
     Score        = score;
     Controller   = interactionController;
     GameResults  = gameResults;
     Rounds       = rounds;
 }
Beispiel #34
0
 public PublishingViewModel(ISettings settings, IMessagePublisher publisher, IUserInteraction interaction)
 {
     _settings = settings;
     _publisher = publisher;
     _interaction = interaction;
     PublishDate = DateTime.Today;
     Time = DateTime.UtcNow.ToShortTimeString();
     LoadStoredServers();
     _publisher.Publish(new QueryPotentialTitleUiMsg(pt => Title = pt));
 }
Beispiel #35
0
        public async static Task <bool> ShowDialogAsync(String title = "Generic Message", String content = "Generic Content", String buttonText = "OK")
        {
            IUserInteraction ui = DependencyService.Get <IUserInteraction>();

            if (ui != null)
            {
                return(await ui.ShowDialogAsync(title, content));
            }
            return(false);
        }
        public VehicleDetailViewModel(IMyShuttleClient myShuttleClient,
            IMvxPhoneCallTask phoneCallTask,
            IUserInteraction userInteraction,
            ILocationServiceSingleton locationService,
            IApplicationSettingServiceSingleton applicationSettingService) : base(myShuttleClient,
                phoneCallTask, userInteraction, locationService, applicationSettingService)
        {

            if (DesignMode.DesignModeEnabled)
            {
                CurrentVehicle = new Core.DocumentResponse.Vehicle
                {
                    Make = "A",
                    Model = "B",
                };
            }

        }
        public VehicleDetailViewModel(
            IMyShuttleClient myShuttleClient,
            IMvxPhoneCallTask phoneCallTask,
            IUserInteraction userInteraction,
            ILocationServiceSingleton locationService,
            IApplicationSettingServiceSingleton applicationSettingService)
        {
            if (myShuttleClient == null)
            {
                throw new ArgumentNullException("myShuttleClient");
            }

            if (phoneCallTask == null)
            {
                throw new ArgumentNullException("phoneCallTask");
            }

            if (userInteraction == null)
            {
                throw new ArgumentNullException("userInteraction");
            }

            if (locationService == null)
            {
                throw new ArgumentNullException("locationService");
            }

            if (applicationSettingService == null)
            {
                throw new ArgumentNullException("applicationSettingService");
            }

            _myShuttleClient = myShuttleClient;
            _phoneCallTask = phoneCallTask;
            _userInteraction = userInteraction;
            _locationService = locationService;
            ApplicationSettingService = applicationSettingService;

            this.InitializeCommands();
        }
Beispiel #38
0
 public ShowMessage(IUserInteraction userInteraction)
 {
     _userInteraction = userInteraction;
 }
Beispiel #39
0
        private static void Synchronize(MongoScriptRunner scriptRunner, IUserInteraction userInteraction, CmdLine cmdLine,
            MongoUrlBuilder mongoUrlBuilder)
        {
            var client = CreateMongoClient(mongoUrlBuilder);
            var filter = new CategoryMatcher();

            try
            {
                System.Console.Out.WriteLine("Running scripts from {0} on database {1}", cmdLine.SourceDir, mongoUrlBuilder.DatabaseName);

                var synchronizer = new ScriptSynchronizer(client.GetServer().GetDatabase(mongoUrlBuilder.DatabaseName), cmdLine.LogCollection, scriptRunner, userInteraction);
                var sourceScripts = new FileScriptEnumerator(cmdLine.SourceDir)
                    .AllScripts()
                    .Where(script => filter.IsMatch(script.Name, cmdLine.Environment))
                    .ToArray();
                var scriptLog = GetScriptLog(mongoUrlBuilder, cmdLine).ToArray();
                bool wasAborted = synchronizer.Synchronize(scriptLog, sourceScripts);
                if (wasAborted)
                {
                    System.Console.Out.WriteLine("Aborting...");
                    Environment.Exit(0);
                }
            }
            finally
            {
                client.GetServer().Disconnect();
            }
        }
Beispiel #40
0
        public Game(IUserInteraction userInteraction)
        {
            _userInteraction = userInteraction;

            CreateTeams();
        }
Beispiel #41
0
 public Program(IUserInteraction user_interaction)
 {
     this.user_interaction = user_interaction;
 }
 public SettingsViewModel(IApplicationSettingServiceSingleton applicationSettingService,
     IMvxMessenger messenger, IUserInteraction userInteraction) : base(applicationSettingService,
         messenger, userInteraction)
 {
 }
Beispiel #43
0
 public SelectionToLink(TextContext selectionText, IUserInteraction userInteraction)
     : base(selectionText)
 {
     _userInteraction = userInteraction;
 }
Beispiel #44
0
 public DisplayPopup(IUserInteraction userInteraction)
 {
     _userInteraction = userInteraction;
 }
 public StandardMarkdownCommands(IUserInteraction userInteraction)
 {
     _userInteraction = userInteraction;
 }
Beispiel #46
0
 public StandardDialog(IDialogBuilder<Answer> dialogBuilder, IUserInteraction userInteraction, IDispatcherSchedulerProvider scheduler)
 {
     _dialogBuilder = dialogBuilder;
     _userInteraction = userInteraction;
     _scheduler = scheduler;
 }
Beispiel #47
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BotSettings"/> class.
        /// </summary>
        /// <param name="userInteraction">UserInteraction.</param>
        public BotSettings(IUserInteraction userInteraction)
            : base("Bot.config")
        {
            this.userInteraction = userInteraction;

            AutoJoins = new List<string>();
            IgnoredUsers = new List<string>();
        }