protected BotAction(BotViewModel bot, string displayName) { this.bot = bot; DisplayName = displayName; State = ActionState.Stopped; Route = new ObservableCollection <Position2DViewModel>(); }
public override void OnAttached() { base.OnAttached(); BotViewModel botViewModel = Bot.GetViewModel(); LayoutDocument layout = botViewModel.AddDocument(this, () => new CharacterInfoView()); layout.Title = "Character Info"; layout.CanClose = false; }
public static void HandleBotAddedMessage(object dummy, BotAddedMessage message) { var model = new BotViewModel(message.Bot); var layout = UIManager.Instance.AddDocument(model, () => new BotControl()); if (layout == null) return; layout.Title = "Bot #" + message.Bot.Id; layout = model.AddDocument(new GeneralTabViewModel(message.Bot), () => new GeneralTab()); layout.Title = "General"; }
public static void UpdateBot(this Bot bot, BotViewModel botVm) { bot.ID = botVm.ID; bot.Name = botVm.Name; bot.Alias = botVm.Alias; bot.CreatedBy = botVm.CreatedBy; bot.CreatedDate = DateTime.Now; bot.UserID = botVm.UserID; bot.Status = botVm.Status; }
public override void OnDetached() { base.OnDetached(); BotViewModel viewModel = Bot.GetViewModel(); if (viewModel != null) { viewModel.RemoveDocument(ViewModel); } }
public override void OnDetached() { base.OnDetached(); Bot.Dispatcher.MessageDispatched -= OnMesssageDispatched; BotViewModel viewModel = Bot.GetViewModel(); if (viewModel != null) { viewModel.RemoveDocument(View); } }
public override void OnDetached() { base.OnDetached(); var settings = Bot.Settings.GetOrAddEntry <BasicPluginSettings>(); settings.FloodEntries = FloodEntries.ToArray(); BotViewModel viewModel = Bot.GetViewModel(); viewModel.RemoveDocument(View); }
public ActionResult GetListOfSettings(BotViewModel vm) { var ctx = new ApplicationDbContext(); var model = ctx.Bots.Where(x => x.GameID == vm.GameID).ToList(); var bots = model.Select(x => new BotViewModel { Id = x.Id, Login = x.Login, Password = x.Password, StartBot = x.StartBot, }); return(PartialView("_ListOfSettingsPartial", bots)); }
public IActionResult SubmitQuestion(string Question) { try { BotViewModel botViewModel = new BotViewModel(); return(Ok(botViewModel.Predict(Question))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public static void HandleBotAddedMessage(object dummy, BotAddedMessage message) { var model = new BotViewModel(message.Bot); var layout = UIManager.Instance.AddDocument(model, () => new BotControl()); if (layout == null) { return; } layout.Title = "Bot #" + message.Bot.Id; layout = model.AddDocument(new GeneralTabViewModel(message.Bot), () => new GeneralTab()); layout.Title = "General"; }
public async Task <IActionResult> AddBot(BotViewModel model) { BotControl control = new BotControl(); await _context.Bots.AddAsync(new Database.Models.Bot { BotId = control.StartBot(model.Token), isWorking = true, Title = model.Name, Token = model.Token }); await _context.SaveChangesAsync(); return(RedirectToAction("List")); }
public override void OnAttached() { base.OnAttached(); Bot.Dispatcher.MessageDispatched += OnMesssageDispatched; BotViewModel viewModel = Bot.GetViewModel(); LayoutDocument layout = viewModel.AddDocument(this, () => new SnifferView()); layout.Title = "Sniffer"; layout.CanClose = false; View.Dispatcher.Invoke(new Action(() => (m_collectionViewSource = View.Resources["Messages"] as CollectionViewSource).Filter += FilterMethod)); }
public bool EditBot(BotViewModel model, string modifiedBy) { //this.CheckBotForExistingName(model.Name); var bot = base.FindBotById(model.Id); bot.Name = model.Name; bot.ModifiedBy = modifiedBy; bot.Image = model.Image; this.Data.BotRepository.Update(bot); return(Convert.ToBoolean(this.Data.SaveChanges())); }
public MainWindow() { InitializeComponent(); JsonFileService.InitializeAllFiles(); viewModel = new BotViewModel(); this.DataContext = viewModel; Pages.Settings.AppearanceViewModel settings = new Pages.Settings.AppearanceViewModel(); settings.SetThemeAndColor(UserInterface.Default.SelectedThemeDisplayName, UserInterface.Default.SelectedThemeSource, UserInterface.Default.SelectedAccentColor, UserInterface.Default.SelectedFontSize); }
public ActionResult Start(BotViewModel vm) { var ctx = new ApplicationDbContext(); var bot = new Bot { Id = vm.Id, Login = vm.Login, Password = vm.Password, StartBot = vm.StartBot, GameID = vm.GameID, IsStarted = true, }; ctx.Entry(ctx.Bots.Where(x => x.Id == vm.Id).First()).CurrentValues.SetValues(bot); return(View("BotSettings", "")); }
public override void OnAttached() { base.OnAttached(); var settings = Bot.Settings.GetOrAddEntry <BasicPluginSettings>(); m_floodEntries = new ObservableCollection <FloodEntry>(settings.FloodEntries); m_readOnlyFloodEntries = new ReadOnlyObservableCollection <FloodEntry>(m_floodEntries); BotViewModel viewModel = Bot.GetViewModel(); LayoutDocument layout = viewModel.AddDocument(this, () => new ChatView()); layout.Title = "Chat"; layout.CanClose = false; View.Dispatcher.Invoke(new Action(() => m_channelNameConverter = View.Resources["ChannelNameConverter"] as ChannelNameConverter)); }
public ActionResult Edit([Bind(Include = "Id,Name,Image")] BotViewModel bot) { try { if (this.ModelState.IsValid) { this._botService.EditBot(bot, this.User.Identity.Name); return(RedirectToAction("Index")); } return(View(bot)); } catch (NotFoundException ex) { return(HttpNotFound(ex.Message)); } }
public async static Task <BotViewModel> GetBotViewModel(string id, IConfiguration _configuration, BotsRepository _botsRepository) { var httpClient = new HttpClient(); var bot = _botsRepository.GetBot(id); var botResult = await httpClient.GetStringAsync($"{_configuration["RunnerApiUrl"]}/check?id={id}"); var botParsedResult = JsonConvert.DeserializeObject <Response>(botResult); var botViewModel = new BotViewModel { Bot = bot, Status = Convert.ToBoolean(botParsedResult.status) }; return(botViewModel); }
public BotViewModel GetLatestArranged() { try { var viewModel = new BotViewModel(); var lastFolder = _directoryManager.GetLastFolder(DirSwitcher.BotForecast); var results = _directoryManager.GetListByBotArrange(lastFolder); viewModel.Buy = results.BuyAssets; viewModel.Consider = results.ConsiderAssets; viewModel.DontBuy = results.DontBuyAssets; viewModel.Report = _directoryManager.GetArrangeBotReport(lastFolder); return(viewModel); } catch (Exception e) { throw new Exception(e.Message); } }
public ActionResult BotSettings(BotViewModel botvm, string id) { var ctx = new ApplicationDbContext(); IEnumerable <Bot> bots = new List <Bot>(); var bot = new Bot() { Login = botvm.Login, Password = botvm.Password, StartBot = botvm.StartBot, GameID = id, }; ctx.Bots.Add(bot); ctx.SaveChanges(); return(View()); //return PartialView(@"~/Views/Game/_ListOfSettingsPartial.cshtml"); }
// GET: /<controller>/ public IActionResult Index() { IBotRepository _botRepositorio; //IBotViewModelRepository _casa; //_casa = new BotViewModelRepositorio(); Bot diego = new Bot() { BotId = 1, BotNome = "f" }; _botRepositorio = new BotRepository(); var a = _botRepositorio.GetAllEntity(); List <BotViewModel> ListabotVM = new List <BotViewModel>(); foreach (var item in a) { BotViewModel botvm = new BotViewModel { BotId = item.BotId }; ListabotVM.Add(botvm); } // _botRepositorio.Insert(diego); //_botRepositorio.Save(); // _botRepositorio.Update() // _botRepositorio.Update(diego); // _botRepositorio.Save(); // var g= _botRepositorio.GetEntityByID(1); // _botRepositorio.Delete(n => n.BotId == diego.BotId); // _botRepositorio.Save(); //Database.SqlQuery<Bot>("exec GetCoursesByStudentId").ToList<Bot>(); //var b = _botRepositorio.GetAllEntity(); return(View()); }
public HttpResponseMessage Create(HttpRequestMessage request, BotViewModel botVm) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (String.IsNullOrEmpty(botVm.UserID)) { response = request.CreateResponse(HttpStatusCode.NotFound); return response; } Bot botDb = new Bot(); botDb.UpdateBot(botVm); var botReturn = _botService.Create(ref botDb); try { // create file bot aiml //string pathFolderAIML = ConfigurationManager.AppSettings["AIMLPath"]; string pathFolderAIML = PathServer.PathAIML; string nameFolderAIML = "User_" + botVm.UserID + "_BotID_" + botReturn.ID; string pathString = System.IO.Path.Combine(pathFolderAIML, nameFolderAIML); System.IO.Directory.CreateDirectory(pathString); } catch (Exception ex) { } Setting settingDb = new Setting(); settingDb.BotID = botDb.ID; settingDb.Color = "rgb(75, 90, 148);"; settingDb.UserID = botVm.UserID; settingDb.Logo = "assets/images/user_bot.jpg"; _settingService.Create(settingDb); _settingService.Save(); var reponseData = Mapper.Map <Bot, BotViewModel>(botReturn); response = request.CreateResponse(HttpStatusCode.OK, reponseData); return response; })); }
public BotPage() { InitializeComponent(); BindingContext = vm = ViewModelLocator.MainViewModel; }
public BotUserControl(BotViewModel viewModel) { ViewModel = viewModel; InitializeComponent(); }
public async Task <BotViewModel> MakeBotForecast(int rsi, List <int> trend, List <int> border) { var viewModel = new BotViewModel(); if (trend.Count <= 0) { throw new Exception("Select at least one trend option!"); } if (border.Count <= 0) { throw new Exception("Select at least one border option!"); } const int periods = 24; const int dataHours = 230; IEnumerable <string> assets; string lastFolder; try { //assets = _fileManager.ReadAssetsFromExcel(_directoryManager.AsstesLocation); assets = _fileManager.ReadAssetsFromExcel(_directoryManager.ObservablesLocation); var currentTime = DateTime.Now; Parallel.ForEach(assets, asset => { var pathToFolder = _directoryManager.GenerateForecastFolder(asset, periods, DirSwitcher.BotForecast, currentTime); var normalized = _processModel.GetDataAuto(asset, dataHours); if (normalized == null || !normalized.Any()) { _directoryManager.RemoveFolder(pathToFolder); var zeroResults = new ExcelBotArrangeLog() { AssetName = asset, Log = Indicator.ZeroRezults.ToString(), Rate = "1", Width = "0", Volume = "0", Change = "0", Rsi = "0", BotArrange = BotArrange.DontBuy.ToString() }; Shared.ArrangeBotLog(zeroResults); return; } var csv = _fileManager.CreateDataCsv(normalized, pathToFolder); if (string.IsNullOrEmpty(csv)) { var zeroResults = new ExcelBotArrangeLog() { AssetName = asset, Log = Indicator.ZeroRezults.ToString(), Rate = "1", Width = "0", Volume = "0", Change = "0", Rsi = "0", BotArrange = BotArrange.DontBuy.ToString() }; Shared.ArrangeBotLog(zeroResults); return; } _directoryManager.SaveDataFile(csv, pathToFolder); _pythonExec.RunPython(pathToFolder, periods, false, false); var pathToOut = _directoryManager.FilePathOut(pathToFolder); var pathToComponents = _directoryManager.FileComponentsOut(pathToFolder); var pathToForecast = _directoryManager.FileForecastOut(pathToFolder); var outCreated = _directoryManager.WaitForFile(pathToOut, 60); var componentsCreated = _directoryManager.WaitForFile(pathToComponents, 10); var forecastCreated = _directoryManager.WaitForFile(pathToForecast, 10); if (!outCreated.Result || !forecastCreated.Result || !componentsCreated.Result) { return; } var stats = _fileManager.BuildOutTableRows(pathToOut, periods); var performance = _utility.DefinePerformance(stats); var marketFeatures = _utility.GetFeatures(normalized, asset); var rsiCalculated = _utility.Rsi(normalized); var botArrange = _directoryManager.SpecifyDirByIndicators(pathToFolder, rsi, trend, border, performance, rsiCalculated); var log = new ExcelBotArrangeLog() { AssetName = asset, Log = performance.Indicator.ToString(), Rate = performance.Rate.ToString(), Width = performance.Width.ToString(), Volume = marketFeatures.Volume.ToString() + "BTC", Change = marketFeatures.Change.ToString("N2"), Rsi = rsiCalculated.ToString("N2") + "%", BotArrange = botArrange.ToString() }; Shared.ArrangeBotLog(log); } ); lastFolder = _directoryManager.GetLastFolder(DirSwitcher.BotForecast); var results = _directoryManager.GetListByBotArrange(lastFolder); viewModel.Buy = results.BuyAssets; viewModel.Consider = results.ConsiderAssets; viewModel.DontBuy = results.DontBuyAssets; var res = _fileManager.WriteArrangeBotLogExcel(lastFolder, Shared.GetArrangedBotLog); _directoryManager.WriteArrangeBotLogToExcel(lastFolder, res); Shared.ClearArrangeBotLog(); viewModel.Report = _directoryManager.GetArrangeBotReport(lastFolder); var requests = _requestHelper.GetStats(); viewModel.CallsMadeHisto = requests.CallsMade.Histo; viewModel.CallsLeftHisto = requests.CallsLeft.Histo; return(viewModel); } catch (Exception e) { lastFolder = _directoryManager.GetLastFolder(DirSwitcher.BotForecast); if (Shared.GetArrangedBotLog.Any()) { var res = _fileManager.WriteLogExcel(lastFolder, Shared.GetArrangedBotLog); _directoryManager.WriteLogToExcel(lastFolder, res); Shared.ClearArrangeBotLog(); } throw new Exception(e.Message); } }
public ActionFactory(BotViewModel bot) { this.bot = bot; }
public TransferPokemonWithAlgorithmAction(BotViewModel bot) : base(bot, "Transfer Pokemon") { }
public ForceUnbanAction(BotViewModel bot) : base(bot, "Force unban") { }
private void ConnectToChannel() { BotViewModel.SwitchChannels(Channel); }
public BotSayfasi() { InitializeComponent(); BindingContext = new BotViewModel(); }
public FarmingAction(BotViewModel bot) : base(bot, "Farm") { }