コード例 #1
0
        private void Load1()
        {
            _items = new List <SavedCommandItem3>();

            foreach (var file in Directory.GetFiles(_itemsFolder, "*.cmd"))
            {
                try {
                    var cmd  = JsonFile.Read <SavedCommand>(file);
                    var cmd3 = new SavedCommand3()
                    {
                        ConnectionStrings = new Dictionary <string, object> {
                            { "server", cmd.Server }
                        },
                        ServiceBus = cmd.ServiceBus,
                        Queue      = cmd.Queue,
                        Transport  = cmd.Transport,
                        Command    = cmd.Command
                    };

                    var item = new SavedCommandItem3(cmd.DisplayName, file, false, cmd.LastSent);

                    item.SetCommand(cmd3);

                    _items.Add(item);
                } catch { }
            }

            _items = _items.OrderByDescending(i => i.LastSent).ToList();
        }
コード例 #2
0
        public SavedCommandItem3 AddCommand(object command, string serviceBus, string transport, Dictionary <string, object> connectionSettings, string queue)
        {
            SavedCommandItem3 item = null;

            var co = new CompareObjects();

            foreach (var c in _items)
            {
                if (co.Compare(c.SentCommand, command))
                {
                    item = c; // TODO: When we show what ServiceBus/Server/Queue the command has been sent to,
                    // then also compare those values
                    break;
                }
            }

            if (item == null)
            {
                item = new SavedCommandItem3(command.GetType().GetDisplayName(command).CutEnd(70), null, false, DateTime.Now);

                SavedCommand3 cmd = new SavedCommand3();
                cmd.Command = command;

                cmd.ServiceBus        = serviceBus;
                cmd.Transport         = transport;
                cmd.ConnectionStrings = connectionSettings;
                cmd.Queue             = queue;

                item.SetCommand(cmd);

                _items.Insert(0, item);
            }

            item.LastSent = DateTime.Now;

            Save();

            return(item);
        }
コード例 #3
0
    public SavedCommandItem3 AddCommand(object command, string serviceBus, string transport, Dictionary<string, object> connectionSettings, string queue) {
      SavedCommandItem3 item = null;

      var co = new CompareObjects();

      foreach( var c in _items ) {

        if( co.Compare(c.SentCommand, command) ) {
          item = c; // TODO: When we show what ServiceBus/Server/Queue the command has been sent to, 
          // then also compare those values
          break;
        }
      }

      if( item == null ) {
        item = new SavedCommandItem3(command.GetType().GetDisplayName(command).CutEnd(70), null, false, DateTime.Now);

        SavedCommand3 cmd = new SavedCommand3();
        cmd.Command = command;

        cmd.ServiceBus = serviceBus;
        cmd.Transport = transport;
        cmd.ConnectionStrings = connectionSettings;
        cmd.Queue = queue;

        item.SetCommand(cmd);

        _items.Insert(0, item);
      }

      item.LastSent = DateTime.Now;

      Save();

      return item;
    }
コード例 #4
0
    private void Load1() {
      _items = new List<SavedCommandItem3>();

      foreach( var file in Directory.GetFiles(_itemsFolder, "*.cmd") ) {
        try {
          var cmd = JsonFile.Read<SavedCommand>(file);
          var cmd3 = new SavedCommand3() { 
            ConnectionStrings = new Dictionary<string, object> { { "server", cmd.Server } },
            ServiceBus = cmd.ServiceBus, 
            Queue = cmd.Queue, 
            Transport = cmd.Transport, 
            Command = cmd.Command };

          var item = new SavedCommandItem3(cmd.DisplayName, file, false, cmd.LastSent);

          item.SetCommand(cmd3);

          _items.Add(item);
        } catch { }
      }

      _items = _items.OrderByDescending(i => i.LastSent).ToList();
    }