Example #1
0
        static void Main(string[] args)
        {
            StartIfNotRunning();

            OnSaveDelegate onSave = Save;

            cs = new ControllerSettings(onSave);

            //while (cs == null)
            //{
            //  Thread.Sleep(10);
            //}

            //WebSocketController wsc = new WebSocketController(cs.GetAuthCode);
            WebSocketController wsc = new WebSocketController(GetAuthCode);

            xc = new XboxControls(wsc, cs);

            wsc.Connect();

            //Thread t3 = new Thread(new ThreadStart(() =>
            //{
            //  while (cs.isRunning)
            //  {
            //    xc.CheckInput();
            //    Thread.Sleep(1);
            //  }
            //}));
            //t3.Start();

            //t3.Join();
            xc.ThreadStart();
        }
 public ControllerSettings(OnSaveDelegate onSave)
     : base(onSave: onSave)
 {
     t = new Thread(new ThreadStart(() => {
         this.gui = new ControllerSettingsGUI(onSave);
         gui.Start();
     }));
     t.Start();
 }
Example #3
0
    //Save data to our database.
    public IEnumerator SaveData(string path, string data, OnSaveDelegate onSaveDelegate = null)
    {
        var dataTask = db.RootReference.Child(path).SetRawJsonValueAsync(data);

        yield return(new WaitUntil(() => dataTask.IsCompleted));

        if (dataTask.Exception != null)
        {
            Debug.LogWarning(dataTask.Exception);
        }

        if (onSaveDelegate != null)
        {
            onSaveDelegate();
        }
    }
        public ControllerSettingsGUI(OnSaveDelegate onSave)
        {
            _onSave = onSave;
            InitializeComponent();
            Dictionary <string, string> vals = new Dictionary <string, string>
            {
                { "PLAY_PAUSE", "Play/Pause" },
                { "TOGGLE_REPEAT", "Toggle Repeat" },
                { "TOGGLE_SHUFFLE", "Toggle Shuffle" },
                { "INCREASE_VOLUME", "Increase Volume" },
                { "DECREASE_VOLUME", "Decrease Volume" },
                { "BACK", "Back" },
                { "FORWARD", "Forward" },
                { "TOGGLE_THUMBS_UP", "Toggle Thumbs Up" },
                { "TOGGLE_THUMBS_DOWN", "Toggle Thumbs Down" }
            };

            foreach (ComboBox cb in this.Controls.OfType <ComboBox>())
            {
                cb.DataSource    = new BindingSource(vals, null);
                cb.ValueMember   = "Key";
                cb.DisplayMember = "Value";
                //if (vals.ContainsKey(cb.Name.Replace("cb", "")+"Mapping"))
                string appKey = cb.Name.Replace("cb", "") + "Mapping";
                if (ConfigurationManager.AppSettings[appKey] != null)
                {
                    cb.SelectedItem = vals.FirstOrDefault(v => v.Key == ConfigurationManager.AppSettings[appKey].ToUpperInvariant());
                }
            }
            tsmiShowWindow.Click += (object sender, EventArgs args) => {
                Show();
            };
            tsmiExit.Click += (object sender, EventArgs args) =>
            {
                Application.ExitThread();
            };
            tsmiAbout.Click += (object sender, EventArgs args) =>
            {
                MessageBox.Show("GPMDP Controller\r\nBy Scott Karbon", "About");
            };
            gpmcNotifyIcon.Visible = true;
        }
Example #5
0
        public ColumnSelectorVM(IEnumerable <GuiGridColumn> columns, OnSaveDelegate onSave)
        {
            _onSave = onSave;

            CloseCommand = new DelegateCommand(
                o => true,
                o => CloseAction()
                );

            SaveCommand = new DelegateCommand(
                o => true,
                o => Save()
                );

            UpColumnCommand = new DelegateCommand(
                o => SelectedSelectedColumn != null && SelectedColumns.IndexOf(SelectedSelectedColumn) > 0,
                o => UpColumn(SelectedSelectedColumn)
                );

            DownColumnCommand = new DelegateCommand(
                o => SelectedSelectedColumn != null && SelectedColumns.IndexOf(SelectedSelectedColumn) < SelectedColumns.Count - 1,
                o => DownColumn(SelectedSelectedColumn)
                );

            AddColumnCommand = new DelegateCommand(
                o => SelectedAvailableColumn != null,
                o => AddColumn(SelectedAvailableColumn)
                );

            RemoveColumnCommand = new DelegateCommand(
                o => SelectedSelectedColumn != null,
                o => RemoveColumn(SelectedSelectedColumn)
                );

            ResetDefaultsCommand = new DelegateCommand(
                o => true,
                o => ResetDefaults()
                );

            SetColumns(columns);
        }
 public ControllerUserInterface(OnSaveDelegate onSave)
 {
     _onSave = onSave;
 }