コード例 #1
0
        public NoteBuilderHandler()
        {
            chain                = new List <BuilderCommand>();
            noteBuilder          = new NoteBuilder();
            noteBuilderResources = new NoteBuilderResources();

            SetDurationCommand    setDurationCommand    = new SetDurationCommand(ref noteBuilder, ref noteBuilderResources);
            SetMoleOrCrossCommand setMoleOrCrossCommand = new SetMoleOrCrossCommand(ref noteBuilder, ref noteBuilderResources);
            SetOctaveCommand      setOctaveCommand      = new SetOctaveCommand(ref noteBuilder, ref noteBuilderResources);
            SetPitchCommand       setPitchCommand       = new SetPitchCommand(ref noteBuilder, ref noteBuilderResources);
            SetPointsCommand      setPointsCommand      = new SetPointsCommand(ref noteBuilder, ref noteBuilderResources);
            SetTildeCommand       setTildeCommand       = new SetTildeCommand(ref noteBuilder, ref noteBuilderResources);

            chain.Add(setDurationCommand);
            chain.Add(setMoleOrCrossCommand);
            chain.Add(setOctaveCommand);
            chain.Add(setPitchCommand);
            chain.Add(setPointsCommand);
            chain.Add(setTildeCommand);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainPageViewModel()
        {
            // init the commands
            SetServerIPCmd = new SetServerIPCommand(this);
            SetDurationCmd = new SetDurationCommand(this);
            SmileCmd       = new SendSmileCommand(this);
            AngryCmd       = new SendAngryCommand(this);

            // check the internet connection and display appropriate message
            IsConnected = Connectivity.NetworkAccess == NetworkAccess.Internet;
            DisplayConnectivityMessage();
            // handle connectivity changes
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;

            // get server ip from preferences
            ServerIP = Preferences.Get(ServerIPKey, string.Empty);
            SetServerIPCmd.Execute(null);

            // get duration from preferences
            DurationSec = Preferences.Get(DurationKey, 0);
        }