private void Load1()
        {
            _items = new List <SavedCommandItem>();

            foreach (var file in Directory.GetFiles(_itemsFolder, "*.cmd"))
            {
                try {
                    var cmd  = JsonFile.Read <SavedCommand>(file);
                    var cmd2 = new SavedCommand2()
                    {
                        Server     = cmd.Server,
                        ServiceBus = cmd.ServiceBus,
                        Queue      = cmd.Queue,
                        Transport  = cmd.Transport,
                        Command    = cmd.Command
                    };

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

                    item.SetCommand(cmd2);

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

            _items = _items.OrderByDescending(i => i.LastSent).ToList();
        }
        public SavedCommandItem AddCommand(object command, string serviceBus, string transport, string server, string queue)
        {
            SavedCommandItem 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 SavedCommandItem(command.GetType().GetDisplayName(command).CutEnd(70), null, false, DateTime.Now);

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

                cmd.ServiceBus = serviceBus;
                cmd.Transport  = transport;
                cmd.Server     = server;
                cmd.Queue      = queue;

                item.SetCommand(cmd);

                _items.Insert(0, item);
            }

            item.LastSent = DateTime.Now;

            Save();

            return(item);
        }
        public SavedCommandItem AddCommand(object command, string serviceBus, string transport, string server, string queue)
        {
            SavedCommandItem 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 SavedCommandItem(command.GetType().GetDisplayName(command).CutEnd(70), null, false, DateTime.Now);

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

            cmd.ServiceBus = serviceBus;
            cmd.Transport = transport;
            cmd.Server = server;
            cmd.Queue = queue;

            item.SetCommand(cmd);

            _items.Insert(0, item);
              }

              item.LastSent = DateTime.Now;

              Save();

              return item;
        }
        public void SetCommand(SavedCommand2 cmd)
        {
            _sentCommand = cmd;

              IsNew = true;
        }
        private void Load1()
        {
            _items = new List<SavedCommandItem>();

              foreach( var file in Directory.GetFiles(_itemsFolder, "*.cmd") ) {
            try {
              var cmd = JsonFile.Read<SavedCommand>(file);
              var cmd2 = new SavedCommand2() {
            Server = cmd.Server,
            ServiceBus = cmd.ServiceBus,
            Queue = cmd.Queue,
            Transport = cmd.Transport,
            Command = cmd.Command };

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

              item.SetCommand(cmd2);

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

              _items = _items.OrderByDescending(i => i.LastSent).ToList();
        }
        public void SetCommand(SavedCommand2 cmd)
        {
            _sentCommand = cmd;

            IsNew = true;
        }