示例#1
0
        private void btnCreer_Click(object sender, EventArgs e)
        {
            try {
                CtrlConfiguration cc      = new CtrlConfiguration(connexion);
                string            equipe1 = cbEquipe1.Text;
                string            equipe2 = cbEquipe2.Text;
                string            duree   = dtpMitemps.Value.ToString("HH:mm:ss");
                string            partie  = cc.Create(equipe1, equipe2, duree);
                ViewCoursMatch    vcm     = new ViewCoursMatch(connexion, partie, duree, "1", equipe1, equipe2);
                vcm.Show();

                if (this.partie != null)
                {
                    Model.ProchainePartieDAO ppdao   = new Model.ProchainePartieDAO(connexion);
                    Model.PartieDAO          ptdao   = new Model.PartieDAO(connexion);
                    Model.Partie             encours = ptdao.Select("WHERE id='" + partie + "'").First();
                    this.partie.Partie = encours;

                    ppdao.Update(this.partie.ToUpdate(), "WHERE id='" + this.partie.Id + "'");
                }
            } catch (Exception ex) {
                throw ex;
                //throw new Exception("Etape : " + etape);
                //System.Windows.Forms.MessageBox.Show(ex.Message + ":" + ex.StackTrace);
            }
        }
示例#2
0
        private void ParseArguments(string[] args)
        {
            var opts = new OptionSet();

            opts = new OptionSet {
                { "h|help", "", v => ShowHelp(opts) },
                { "host=", "URI of WebSocket host", v => { _uri = v; } },
                { "action=", "Set the functionality of the execution.", v => _action = v },
                { "human", "Force a human readable format.", v => _humanReadable = true }
            };
            if (args.Length == 0)
            {
                ShowHelp(opts);
            }
            var otherArguments = opts.Parse(args);

            if (string.IsNullOrEmpty(_action))
            {
                ShowHelp(opts);
            }
            if (string.IsNullOrEmpty(_uri))
            {
                var cfg = CtrlConfiguration.GetConfiguration("cfg.json");
                if (cfg == null)
                {
                    ShowHelp(opts);
                }

                _uri = cfg?.Host;
            }

            if (otherArguments.Count > 0)
            {
                Console.WriteLine("UNKNWON");
                foreach (var arg in otherArguments)
                {
                    Console.WriteLine($"  ?? {arg}");
                }
                Console.WriteLine("");
                ShowHelp(opts);
            }
        }
示例#3
0
        private void ParseArguments(string[] args)
        {
            var opts = new OptionSet();

            opts = new OptionSet {
                { "h|help", "", v => ShowHelp(opts) },
                { "host=", "URI of WebSocket host", v => { _uri = v; } },
                { "action=", "Set the functionality of the execution.", v => _action = v },
                { "oids=", "List of Object IDs of accessories to be queried.", v =>
                  {
                      var parts = v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                      foreach (var p in parts)
                      {
                          if (string.IsNullOrEmpty(p))
                          {
                              continue;
                          }
                          var iv = p.ToInt(-1);
                          if (iv == -1)
                          {
                              continue;
                          }
                          if (!_oids.Contains(iv))
                          {
                              _oids.Add(iv);
                          }
                      }
                  } },
                { "type=", "0:=ACCESSORRY, 1:=ROUTE", v => _type = v.ToInt(-1) }
            };
            if (args.Length == 0)
            {
                ShowHelp(opts);
            }
            try
            {
                var otherArguments = opts.Parse(args);
                if (string.IsNullOrEmpty(_action))
                {
                    ShowHelp(opts);
                }
                if (string.IsNullOrEmpty(_uri))
                {
                    var cfg = CtrlConfiguration.GetConfiguration("cfg.json");
                    if (cfg == null)
                    {
                        ShowHelp(opts);
                    }

                    foreach (var id in cfg.IgnoreOids)
                    {
                        _oidsIgnoreInInit.Add(id);
                    }

                    _uri = cfg?.Host;
                }

                if (otherArguments.Count > 0)
                {
                    Console.WriteLine("UNKNWON");
                    foreach (var arg in otherArguments)
                    {
                        Console.WriteLine($"  ?? {arg}");
                    }
                    Console.WriteLine("");
                    ShowHelp(opts);
                }
            }
            catch (NDesk.Options.OptionException ex)
            {
                Console.WriteLine(ex.Message);
                ShowHelp(opts);
            }
        }
示例#4
0
        private void ParseArguments(string[] args)
        {
            var opts = new OptionSet();

            opts = new OptionSet {
                { "h|help", "", v => ShowHelp(opts) },
                { "host=", "URI of WebSocket host", v => { _uri = v; } },
                { "route=", "Name of the target route.", v => _targetRouteName = v },
                { "oids=", "List of Object ID for which the state is queried.", v =>
                  {
                      var parts = v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                      foreach (var p in parts)
                      {
                          if (string.IsNullOrEmpty(p))
                          {
                              continue;
                          }
                          var iv = p.ToInt(-1);
                          if (iv == -1)
                          {
                              continue;
                          }
                          if (!_oids.Contains(iv))
                          {
                              _oids.Add(iv);
                          }
                      }
                  } }
            };
            if (args.Length == 0)
            {
                ShowHelp(opts);
            }
            var otherArguments = opts.Parse(args);

            if (string.IsNullOrEmpty(_targetRouteName))
            {
                ShowHelp(opts);
            }
            if (_oids.Count <= 0)
            {
                ShowHelp(opts);
            }
            if (string.IsNullOrEmpty(_uri))
            {
                var cfg = CtrlConfiguration.GetConfiguration("cfg.json");
                if (cfg == null)
                {
                    ShowHelp(opts);
                }

                _uri = cfg?.Host;
            }

            if (otherArguments.Count > 0)
            {
                Console.WriteLine("UNKNWON");
                foreach (var arg in otherArguments)
                {
                    Console.WriteLine($"  ?? {arg}");
                }
                Console.WriteLine("");
                ShowHelp(opts);
            }
        }