Exemplo n.º 1
0
        private void OnTheButtonClicked()
        {
            if (CurrentLocation.Inventory.GetItemCount <Wood>() > 0)
            {
                CurrentLocation.Inventory.RemoveItem <Wood>();
                NotificationCommand.Execute("You feel warmer.");
                SoundController.PlayEffect(SoundEffects.FireCrack);
                m_ThePlayer.Energy += 0.5;

                // TODO: add game saving here
            }
        }
Exemplo n.º 2
0
        void OnCommandReceived(CommandReceivedArgs e)
        {
            switch (e.Command.Type)
            {
            case CommandType.Notification:
                NotificationCommand notifCommand = (NotificationCommand)e.Command;
                logViewer.WriteLine(notifCommand.Text, MessageType.Notification);
                break;

            case CommandType.SetWallpaper:
                SetWallpaperCommand setWallCommand = (SetWallpaperCommand)e.Command;
                logViewer.WriteLine("New wallpaper received from " + e.Sender.Ip);
                break;

            default:
                logViewer.WriteLine("Command received from " + e.Sender.Ip);
                break;
            }
        }
Exemplo n.º 3
0
        private void ExecuteQuestIntroduction()
        {
            LastMessage = "You collect some firewood and light a fire.";

            for (var i = 0; i < 5; i++)
            {
                CurrentLocation.Inventory.Items.Add(new Wood());
            }

            NotificationCommand.Execute("Got 5 wood.");

            OverviewTabVisibility    = Visibility.Visible;
            SuppliesTabVisibility    = Visibility.Visible;
            TheButtonVisibility      = Visibility.Visible;
            ButtonChopWoodVisibility = Visibility.Visible;
            BuildingsTabVisibility   = Visibility.Visible;

            TheButtonText = "Add wood to fire";
        }
Exemplo n.º 4
0
 public NotificationAction(object content, object contentTemplateKey, Action execute, Func<bool> canExecute)
 {
     Content = content;
     ContentTemplateKey = contentTemplateKey;
     Command = new NotificationCommand(execute, canExecute);
 }
 public AppBarPromptAction(object content, Action execute, Func <bool> canExecute)
 {
     Content = content;
     Command = new NotificationCommand(execute, canExecute, () => Parent.Hide());
 }
Exemplo n.º 6
0
 void HandleNotifications(NotificationCommand notificationCommand, IConnection connection)
 {
     OnServerNotification(new ServerNotificationEventArgs(notificationCommand.Message));
 }
 private IEnumerable <Guid> GetInstructionIDs(NotificationCommand notificationCommand)
 {
     return(_instructionNotifications.Where(kvp => kvp.Value == notificationCommand).Select(kvp => kvp.Key));
 }
 public GatewayInstructionNotificationMessage(object sender, Guid instructionID, NotificationCommand notificationCommand)
     : this(sender, new Dictionary <Guid, NotificationCommand> {
     { instructionID, notificationCommand }
 })
 {
 }
Exemplo n.º 9
0
 private void OnNotificationReceived(NotificationCommand e)
 {
     logViewer.WriteLine(e.Text, MessageType.Notification);
 }
 public AppBarPromptAction(object content, Action execute, Func<bool> canExecute)
 {
     Content = content;
     Command = new NotificationCommand(execute, canExecute, () => Parent.Hide());
 }
Exemplo n.º 11
0
 public AppBarMenuAction(object content, Action execute, Func<bool> canExecute)
 {
     Content = content;
     Command = new NotificationCommand(execute, canExecute, () => ((Popup)Parent.Parent).IsOpen = false);
 }
Exemplo n.º 12
0
 public AppBarMenuAction(object content, Action execute, Func <bool> canExecute)
 {
     Content = content;
     Command = new NotificationCommand(execute, canExecute, () => ((Popup)Parent.Parent).IsOpen = false);
 }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel" /> class.
        /// </summary>
        internal MainWindowViewModel()
        {
            MonitorSettingsContainer.LoadAllSettings();

            List <BuildInformation> builds = new List <BuildInformation>();

            foreach (var buildServer in MonitorSettingsContainer.BuildServers)
            {
                builds.AddRange(buildServer.GetBuilds());
            }

            selectedRefreshInterval = MonitorSettingsContainer.MonitorSettings.RefreshInterval;
            selectedZoomFactor      = (int)(zoomFactor * 100);
            PinBuildViews           = new List <PinBuildView>();
            BuildAdapters           = new ObservableCollection <BuildAdapter>(builds.Select(build => new BuildAdapter(this, build, false)));

            AvailableTags = new ObservableCollection <FilterTag>(new[] { new FilterTag {
                                                                             IsAllFilter = true, IsSelected = true, Label = Resources.AllFilterLabel
                                                                         } });
            FillAvailableTags();

            CollectionViewSourceBuildAdapters = new CollectionViewSource {
                Source = BuildAdapters
            };
            CollectionViewSourceBuildAdapters.Filter += CollectionViewSourceBuildAdaptersFilter;
            SelectedBuildAdapters = new ObservableCollection <BuildAdapter>();

            ActualValue            = Maximum = MonitorSettingsContainer.MonitorSettings.RefreshInterval;
            this.bigSizeMode       = MonitorSettingsContainer.MonitorSettings.BigSize;
            this.useFullWidth      = MonitorSettingsContainer.MonitorSettings.UseFullWidth;
            this.zoomFactor        = MonitorSettingsContainer.MonitorSettings.ZoomFactor;
            this.isRibbonMinimized = MonitorSettingsContainer.MonitorSettings.RibbonMinimized;

            ApplyExistingTagToBuildCommand = new ApplyExistingTagToBuildCommand(this);
            ApplyNewTagToBuildCommand      = new ApplyNewTagToBuildCommand(this);
            RemoveTagFromBuildCommand      = new RemoveTagFromBuildCommand(this);
            RefreshCommand            = new RelayCommand(Refresh);
            SetRefreshIntervalCommand = new RelayCommand(SetRefreshInterval);
            SetZoomFactorCommand      = new RelayCommand(SetZoomFactor);
            CloseCommand          = new CloseCommand(null);
            AboutCommand          = new RelayCommand(About);
            SettingsCommand       = new SettingsCommand(this);
            NotificationCommand   = new NotificationCommand();
            MinimizeRibbonCommand = new RelayCommand(o => IsRibbonMinimized = !IsRibbonMinimized);
            DoFilterCommand       = new RelayCommand(DoFilter);
            BigSizeModeCommand    = new RelayCommand(o => BigSizeMode = !BigSizeMode);

            var intervals = new List <int>();

            for (var i = 15; i <= 300; i += 15)
            {
                intervals.Add(i);
            }

            RefreshIntervals = new ObservableCollection <int>(intervals);

            var factors = new List <int>();

            for (var i = 100; i <= 300; i += 25)
            {
                factors.Add(i);
            }

            ZoomFactors = new ObservableCollection <int>(factors);

            Refresh();

            var dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal)
            {
                Interval = TimeSpan.FromSeconds(1)
            };

            dispatcherTimer.Tick += DispatcherTimerTick;
            dispatcherTimer.Start();

            if (!MonitorSettingsContainer.BuildServers.Any())
            {
                SettingsCommand.Execute(null);
            }
        }