public HttpResponseMessage AddUser(UserSignUpViewModel userParam) { UserManager userManager = new UserManager(); HistoryManager historyManager = new HistoryManager(); try { var user = new User(); user.UserName = userParam.UserName; user.Password = userParam.Password; user.Email = userParam.Email; user.FirstName = userParam.FirstName; user.MiddleName = userParam.MiddleName; user.LastName = userParam.LastName; userManager.Create(user); var dbUser = userManager.FindUserEmail(user.Email); historyManager.AddHistory(new History(dbUser) { Activity = Activities.Joined, Description = Helper.GenerateActivityDescription(dbUser, Activities.Joined) }); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, user); return response; } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); } }
public void Test4() { IHistoryManager<int> h = new HistoryManager<int>(1); h.Add(2); h.Undo(); h.Add(3); Assert.False(h.CanRedo()); }
public ImageEditControl() { Zoom = 1; InitializeComponent(); _draw_pen = new Pen(Color.White); _draw_brush = new SolidBrush(Color.White); _h_manager = new HistoryManager(); }
//////////////////////////////////////// // LOADS HISTORY ITEMS FROM DATABASE // ////////////////////////////////////// private void History_Manager_Form_Load(object sender, EventArgs e) { var items = HistoryManager.GetItems(); foreach (var item in items) { historyListBox.Items.Add(string.Format("[{0}] {1} ({2})", item.Date, item.Title, item.URL)); } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (listBox1.SelectedItem != null) { HistoryManager?.MakeHistory(null); list.Remove((MonsterSaveBonus)listBox1.SelectedItem); } fill(); }
void Awake() { board = GetComponent <Tilemap>(); redmapManager = GameObject.Find("Redmap").GetComponent <RedmapManager>(); historyManager = GameObject.Find("HistoryManager").GetComponent <HistoryManager>(); selectedMoves = new List <Move>(); SimulateBoard = new Piece[8, 8]; IsSimulate = false; }
private void clearHistoryToolStripMenuItem_Click(object sender, EventArgs e) { var history = HistoryManager.GetHistoryList(); foreach (var item in history) { HistoryManager.DeleteHistoryItem(item); } }
public void Test3() { IHistoryManager<int> h = new HistoryManager<int>(); Assert.Throws<ApplicationException>(delegate { h.Undo(); }); Assert.Throws<ApplicationException>(delegate { h.Redo(); }); h.Add(1); Assert.Throws<ApplicationException>(delegate { h.Undo(); }); Assert.Throws<ApplicationException>(delegate { h.Redo(); }); }
public static HistoryManager GetInstance() { if (Instance == null) { Instance = new GameObject("HistoryManager").AddComponent <HistoryManager> (); } return(Instance); }
public override void Execute() { if (clearhist) { HistoryManager.ClearHistory(); } ResponseBox.KeyDown(EventHandler); ResponseBox.SetItems(HistoryManager.GetHistory()); }
public void Constructor_WithPath() { string path = Path.Combine(@"Data\HistoryManager\BeatSyncHistory-TestCol1.json"); HistoryManager historyManager = new HistoryManager(path); historyManager.Initialize(); Assert.AreEqual(Path.GetFullPath(path), historyManager.HistoryPath); Assert.AreEqual(8, historyManager.Count); }
private void ClearBtn_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Do you really want to clear your training history?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } HistoryManager.ClearTrainingHistoryList(); lstView.Items.Clear(); }
public void Initialize_FileDoesntExist() { string fileName = "BeatSyncHistory-DoesntExist.json"; string filePath = Path.Combine(HistoryTestPathDir, fileName); HistoryManager historyManager = new HistoryManager(filePath); historyManager.Initialize(); Assert.AreEqual(historyManager.Count, 0); }
/// <summary> /// Secondary initializer /// </summary> /// <param name="javascriptEngine"></param> /// <param name="styleEngine"></param> /// <param name="restClient"></param> /// <param name="cookieContainer"></param> /// <param name="historyManager"></param> /// <param name="styleScrapingEnabled"></param> /// <param name="javascriptScrapingEnabled"></param> /// <param name="defaultUriProtocol"></param> public StandardCore(JavascriptEngine javascriptEngine, StyleEngine styleEngine, RestClient restClient, CookieContainer cookieContainer, HistoryManager historyManager, bool styleScrapingEnabled, bool javascriptScrapingEnabled, string defaultUriProtocol) : base(javascriptEngine, styleEngine, restClient, cookieContainer, historyManager, styleScrapingEnabled, javascriptScrapingEnabled, defaultUriProtocol) { }
private async void LoadHistory() { var history = await HistoryManager.GetHistory(); foreach (var item in history) { lvHistoryList.Items.Add(new FileInfo(item)); } }
static void Save(string guid, UIElement root) { var di = HistoryManager.GetDataInfo(guid, true, typeof(HCanvas), typeof(HImage), typeof(TextBox), typeof(HText), typeof(HLine), typeof(HGraphics), typeof(UIElement)); UnsafeDataWriter dw2 = new UnsafeDataWriter(); var db = dw2.Write <HCanvas>(root, di); HistoryManager.AddRecord("ui", guid, db.ToBytes()); }
public void TryAdd_NotInitialized() { var historyManager = new HistoryManager(HistoryTestPathDir); string key = "LKSJDFLKJASDLFKJ"; string songName = null; string mapperName = null; Assert.ThrowsException <InvalidOperationException>(() => historyManager.TryAdd(key, songName, mapperName, 0)); }
private void clearHistoryToolStripMenuItem_Click(object sender, EventArgs e) { var hm = new HistoryManager(); foreach (var item in HistoryManager.GetItems()) { hm.DeleteItem(item.Id); //deletes from db } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (listBox1.SelectedItem != null) { HistoryManager.MakeHistory(null); list.Remove((Description)listBox1.SelectedItem); } fill(); }
public void OnToggleTrigger(bool isOn) { if (GlobalData.FrameToggleModifyByUndo) { GlobalData.FrameToggleModifyByUndo = false; return; } HistoryManager.Do(BehaviorFactory.GetUpdateFrameVisibleBehavior(isOn)); }
/// <summary> /// Performs the metadata refresh. /// </summary> public void PerformMetadataRefresh() { if (this.CheckConnectivity()) { UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager; syncManager.PerformMetadataSync(); HistoryManager.ReleaseHistoryManager(); } }
private void InitializeForm(String[] args) { if (urlToolStripTextBox.TextBox != null) { urlToolStripTextBox.TextBox.ContextMenuStrip = urlContextMenuStrip; } helpWebBrowser.StatusTextChanged += helpWebBrowser_StatusTextChanged; switch (args.Length) { case 1: GuideManager.ReadHelpGuide(this, args[0]); break; default: WindowManager.DisableInterface(this); break; } HistoryManager.InitGoBack(this); HistoryManager.InitGoForward(this); office2003ToolStripMenuItem.Checked = true; searchPanel.Visible = false; if (helpWebBrowser.IsOffline) { connectionStatusToolStripStatusLabel.Image = ToolbarResource.disconnect; String text = LanguageUtil.GetCurrentLanguageString("connectionStatus_Disconnected", Name, OptionManager.GetLanguage(this)); connectionStatusToolStripStatusLabel.Text = text; connectionStatusToolStripStatusLabel.ToolTipText = text; } else { connectionStatusToolStripStatusLabel.Image = ToolbarResource.connect; String text = LanguageUtil.GetCurrentLanguageString("connectionStatus_Connected", Name, OptionManager.GetLanguage(this)); connectionStatusToolStripStatusLabel.Text = text; connectionStatusToolStripStatusLabel.ToolTipText = text; } switch (LanguageUtil.GetReallyShortCulture(CultureInfo.CurrentCulture.Name)) { case "en": englishToolStripMenuItem.Checked = true; break; case "it": italianoToolStripMenuItem.Checked = true; break; default: englishToolStripMenuItem.Checked = true; break; } }
private void button1_Click(object sender, EventArgs e) { HistoryManager?.MakeHistory(null); foreach (string s in input.Text.Split(new char[] { ',', ';' })) { Items.Add(s.Trim()); } input.Text = ""; fill(); }
private void button2_Click(object sender, EventArgs e) { if (input.Text.Length > 0) { HistoryManager?.MakeHistory(null); Items.Add(input.Text); } input.Text = ""; fill(); }
private void listBox1_DoubleClick(object sender, EventArgs e) { if (this.listBox1.SelectedItem == null) { return; } HistoryManager?.MakeHistory(null); Items.RemoveAt(listBox1.SelectedIndex); fill(); }
private void HistoryManagerUI_Load(object sender, EventArgs e) { var history = HistoryManager.GetHistoryData(); foreach (var log in history) { string logItem = String.Format("[{0}] | {1} | ({2}) ", log.Date, log.Name, log.URL); listBox1.Items.Add(logItem); } }
private void FilteredHistoryBox_Load(object sender, EventArgs e) { termLabel.Text = String.Format("Results for {0}", term); var list = HistoryManager.filterHistory(term); foreach (var item in list) { searchResults.Items.Add(item); } }
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { // whenever web page is loaded, add it to the history here var item = new HistoryItem(); item.URL = currentUrl; item.title = webBrowser1.DocumentTitle; item.date = DateTime.Now; HistoryManager.AddItem(item); }
public void AddCommand(ICommand command) { //History manager can happen if some events were not released properly. //Project was closed however so change should be take into consideration if (HistoryManager == null) { return; } HistoryManager.AddToHistory(command); }
private void HistoryManagerForm_Load(object sender, EventArgs e) { var items = HistoryManager.GetAllItems(); foreach (var item in items) { listBox1.Items.Add(item.date + ": " + item.title + " " + item.URL); // do better here } }
public static void RemoveConnection(Connection connection, bool markHistory = true) { if (markHistory) { HistoryManager.RecordEditor(); } mainEditor.connections.Remove(connection); RemoveConnectionHistory(connection); }
private void HistoryManagerForm_Load(object sender, EventArgs e) { var history = HistoryManager.GetItems(); listBox1.Items.Clear(); foreach (var pages in history) { listBox1.Items.Add(string.Format("[{0}] {1}({2})", pages.Date, pages.Title, pages.URL)); } }
/////////////////////////////////////// // DELETES SEARCH ITEM FROM HISTORY // ///////////////////////////////////// private void histDeleteButton_Click(object sender, EventArgs e) { // finds candidate for deletion string candidate = historyListBox.GetItemText(historyListBox.SelectedItem); // calls HistoryManager RemoveHist method which deletes the row HistoryManager.RemoveHist(candidate); // deletes the list box selected row as well. historyListBox.Items.RemoveAt(historyListBox.SelectedIndex); }
public SquiggleContextFactory(IInstanceFactory <PluginLoader> pluginLoaderFactory, HistoryManager history, MainWindow window, string clientId) { this.pluginLoaderFactory = pluginLoaderFactory; this.history = history; this.window = window; this.clientId = clientId; }
public HttpResponseMessage AuthenticateUser(UserSignInViewModel userParam) { UserManager userManager = new UserManager(); HistoryManager historyManager = new HistoryManager(); try { var user = userManager.FindAuthenticatedUser(userParam.UserName, userParam.Password); var dbUser = userManager.FindUserEmail(user.Email); historyManager.AddHistory(new History(dbUser) { Activity = Activities.Login, Description = Helper.GenerateActivityDescription(dbUser, Activities.Login) }); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, user); return response; } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); } }
public void Test5() { IHistoryManager<int> h = new HistoryManager<int>(1); Assert.False(h.CanUndo()); Assert.False(h.CanRedo()); }
private bool InitializeBot() { // Read Config File const string configFilePath = "configTS3AudioBot.cfg"; ConfigFile cfgFile = ConfigFile.Open(configFilePath) ?? ConfigFile.Create(configFilePath) ?? ConfigFile.GetDummy(); var afd = cfgFile.GetDataStruct<AudioFrameworkData>(typeof(AudioFramework), true); var bcd = cfgFile.GetDataStruct<BobControllerData>(typeof(BobController), true); var qcd = cfgFile.GetDataStruct<QueryConnectionData>(typeof(QueryConnection), true); var hmd = cfgFile.GetDataStruct<HistoryManagerData>(typeof(HistoryManager), true); var pmd = cfgFile.GetDataStruct<PluginManagerData>(typeof(PluginManager), true); var pld = cfgFile.GetDataStruct<PlaylistManagerData>(typeof(PlaylistManager), true); mainBotData = cfgFile.GetDataStruct<MainBotData>(typeof(MainBot), true); cfgFile.Close(); if (consoleOutput) { Log.RegisterLogger("[%T]%L: %M", "", Console.WriteLine); } if (writeLog && !string.IsNullOrEmpty(mainBotData.logFile)) { var encoding = new UTF8Encoding(false); logStream = new StreamWriter(File.Open(mainBotData.logFile, FileMode.Append, FileAccess.Write, FileShare.Read), encoding); Log.RegisterLogger("[%T]%L: %M\n" + (writeLogStack ? "%S\n" : ""), "", (msg) => { if (logStream != null) try { logStream.Write(msg); logStream.Flush(); } catch (IOException) { } }); } Log.Write(Log.Level.Info, "[============ TS3AudioBot started =============]"); string dateStr = DateTime.Now.ToLongDateString(); Log.Write(Log.Level.Info, "[=== Date: {0}{1} ===]", new string(' ', Math.Max(0, 32 - dateStr.Length)), dateStr); string timeStr = DateTime.Now.ToLongTimeString(); Log.Write(Log.Level.Info, "[=== Time: {0}{1} ===]", new string(' ', Math.Max(0, 32 - timeStr.Length)), timeStr); Log.Write(Log.Level.Info, "[==============================================]"); Log.Write(Log.Level.Info, "[============ Initializing Commands ===========]"); CommandManager = new CommandManager(); CommandManager.RegisterMain(this); Log.Write(Log.Level.Info, "[============ Initializing Modules ============]"); QueryConnection = new QueryConnection(qcd); var playlistManager = new PlaylistManager(pld); BobController = new BobController(bcd, QueryConnection); // old: new VLCConnection(afd.vlcLocation); // new: BobController AudioFramework = new AudioFramework(afd, BobController, playlistManager); SessionManager = new SessionManager(); HistoryManager = new HistoryManager(hmd); PluginManager = new PluginManager(this, pmd); Log.Write(Log.Level.Info, "[=========== Initializing Factories ===========]"); FactoryManager = new ResourceFactoryManager(AudioFramework); FactoryManager.DefaultFactorty = new MediaFactory(); FactoryManager.AddFactory(new YoutubeFactory()); FactoryManager.AddFactory(new SoundcloudFactory()); FactoryManager.AddFactory(new TwitchFactory()); Log.Write(Log.Level.Info, "[=========== Registering callbacks ============]"); // Inform our HistoryManager when a new resource started successfully AudioFramework.OnResourceStarted += HistoryManager.LogAudioResource; // Inform the BobClient on start/stop AudioFramework.OnResourceStarted += BobController.OnResourceStarted; AudioFramework.OnResourceStopped += BobController.OnResourceStopped; // In own favor update the own status text to the current song title AudioFramework.OnResourceStarted += SongUpdateEvent; // Register callback for all messages happening QueryConnection.OnMessageReceived += TextCallback; // Register callback to remove open private sessions, when user disconnects QueryConnection.OnClientDisconnect += (s, e) => SessionManager.RemoveSession(e.InvokerId); Log.Write(Log.Level.Info, "[================= Finalizing =================]"); // Create a default session for all users in all chat SessionManager.DefaultSession = new PublicSession(this); // Connect the query after everyting is set up try { QueryConnection.Connect(); } catch (QueryCommandException qcex) { Log.Write(Log.Level.Error, "There is either a problem with your connection configuration, or the query has not all permissions it needs. ({0})", qcex); return false; } Log.Write(Log.Level.Info, "[============== Connected & Done ==============]"); return true; }
/// <summary> /// Lists the history of edits for a page. /// </summary> /// <param name="id">The ID of the page.</param> /// <returns>An <see cref="IList`HistorySummary"/> as the model.</returns> public ActionResult History(int id) { HistoryManager manager = new HistoryManager(); return View(manager.GetHistory(id).ToList()); }
public ActionResult Revert(Guid versionId, int pageId) { // Check if the page is locked to admin edits only before reverting. PageManager pageManager = new PageManager(); PageSummary page = pageManager.Get(pageId); if (page == null || (page.IsLocked && !RoadkillContext.Current.IsAdmin)) return RedirectToAction("Index", "Home"); HistoryManager manager = new HistoryManager(); manager.RevertTo(versionId); return RedirectToAction("History", new { id = pageId }); }
/// <summary> /// Gets a particular version of a page. /// </summary> /// <param name="id">The Guid ID for the version.</param> /// <returns>A <see cref="PageSummary"/> as the model, which contains the HTML diff /// output inside the <see cref="PageSummary.Content"/> property.</returns> public ActionResult Version(Guid id) { HistoryManager manager = new HistoryManager(); IList<PageSummary> bothVersions = manager.CompareVersions(id).ToList(); string diffHtml = ""; if (bothVersions[1] != null) { string oldVersion = bothVersions[1].Content.WikiMarkupToHtml(); string newVersion = bothVersions[0].Content.WikiMarkupToHtml(); HtmlDiff diff = new HtmlDiff(oldVersion, newVersion); diffHtml = diff.Build(); } else { diffHtml = bothVersions[0].Content.WikiMarkupToHtml(); } PageSummary summary = bothVersions[0]; summary.Content = diffHtml; return View(summary); }
private void toolStripButton5_Click(object sender, EventArgs e) { var hm = new HistoryManager(); var hdg = new HistoryDg(); hdg.InitList(hm.GetHead()); var dr = hdg.ShowDialog(); if (dr == DialogResult.OK) { _list = hm.Get<Entity>(hdg.GetSelected()); ShowToView(_list); } }