private void ReferenceVisibility() { if (muc.ReadBool("Main", "ConsoleButton") == true) { consButton.Visible = true; } else { consButton.Visible = false; } if (muc.ReadBool("Main", "TrayButton") == true) { ttButton.Visible = true; } else { ttButton.Visible = false; } if (muc.ReadBool("Main", "Tooltips") == true) { Info.Visible = true; } else { Info.Visible = false; } MemoryManagement.FlushMemory(); }
private void HandleHotkey() { Graphics SS = Graphics.FromImage(ScSh as Image); SS.CopyFromScreen(0, 0, 0, 0, ScSh.Size); cwl(cc_lang[13]); cwl(cc_lang[14]); if (_sound) { sound.Play(); } DateTime now = DateTime.Now; string name = now.ToString("yyyy-MM-dd,hh-mm-ss"); string dateString = string.Format(@"{0}{1}", muc.Read("Main", "Path"), name + "." + muc.Read("Main", "Format")); cwl(cc_lang[20] + name); SasLabel.Text = cc_lang[11] + cc_lang[21] + ":" + Environment.NewLine + dateString; saveImage(dateString, ScSh, muc.Read("Main", "Format"), muc.ReadInt("Main", "jpgQuality")); pictureBox1.Image = ScSh; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; cwl(cc_lang[11] + cc_lang[21] + " " + dateString); cwl(cc_lang[16]); muc.Write("Main", "LastPath", dateString); if (lstButton.Visible == false) { cwl(cc_lang[22]); lstButton.Visible = true; } SS.Dispose(); MemoryManagement.FlushMemory(); }
//event handler for clicking menu item - cretion of the new room private void MenuStartNewGame_Click(object sender, RoutedEventArgs e) { try { Windows.StartNewHostWindow newGameWindow = new Windows.StartNewHostWindow (SavedDataPlaceholder.SavedAmountOfPlayers, SavedDataPlaceholder.SavedAmountOfDecks, SavedDataPlaceholder.SavedAmountOfJokers, SavedDataPlaceholder.SavedAmountOfStartCards) { Owner = this }; newGameWindow.NewRoomDataChanged += NewRoomDataConfirm_Click; //logging var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Info("Opening creation of new game window"); newGameWindow.ShowDialog(); MemoryManagement.FlushMemory(); } catch (Exception ex) { var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Error("Opening creation of new game window failure: " + ex.Message); } }
public void GetMemoryInformation_ReturnsMemoryInformation() { var memInfo = MemoryManagement.GetMemoryInformation(); Assert.Greater(memInfo.TotalPhysicalMemory, 0); Assert.Greater(memInfo.TotalVirtualMemory, 0); }
//event handler for updating the window private void DataPlaceholder_UpdteTheGame(object sender, UpdateGameWindowEventArgs e) { if (thisPlayerID == e.ReceivedData.PlayerID) { SynchCont.Post(_ => ThisUserControlsEnabler.EnableOrDisableThisUserControls(ref ThisPlayerControl, ref DeckRepresentationControl, e.ReceivedData.CurrentPlayerNumber), null); //assign cards to controls CardsToControlsAssigner CardsAssigner = new CardsToControlsAssigner(this); SynchCont.Post(_ => CardsAssigner.AssignPlayersCards(PlayersControlsMapper, e.ReceivedData.DataOfThisPlayer.ThisPlayerCards, e.ReceivedData.DataOfOtherPlayers), null); SynchCont.Post(_ => CardsAssigner.AssignAmountOfCardsInDeck(e.ReceivedData.AmountOfCardsInDeck), null); SynchCont.Post(_ => CardsAssigner.AddMultipleCardsToUsedCardsControl(e.ReceivedData.NewCardsOnTheTableList), null); //assign properties values - those which implements INotifyPropertyChange interface SynchCont.Post(_ => AssignProperties(e.ReceivedData.CurrentGameStatusData), null); //move posibilities SynchCont.Post(_ => AssignPlayersMovePosibilities(e.ReceivedData.DataOfThisPlayer), null); //players rectangles colors SynchCont.Post(_ => PlayersRectanglesColorAssigner.AssignPlayersRectanglesColors(ref ActivePlayerRectangles, e.ReceivedData.CurrentPlayerNumber), null); SynchCont.Post(_ => OpenMatchingCardInBattleWindow(MatchingCardInBattleMode, AlreadyUsedCardsControl.Cards[0]), null); } SynchCont.Post(_ => MemoryManagement.FlushMemory(), null); }
private static void ReprotectRange(int offset, int size) { // Map pages that are already full as RX. // Map pages that are not full yet as RWX. // On unix, the address must be page aligned. int endOffs = offset + size; int pageStart = offset & ~PageMask; int pageEnd = endOffs & ~PageMask; int fullPagesSize = pageEnd - pageStart; if (fullPagesSize != 0) { IntPtr funcPtr = _basePointer + pageStart; MemoryManagement.Reprotect(funcPtr, (ulong)fullPagesSize, MemoryProtection.ReadAndExecute); } int remaining = endOffs - pageEnd; if (remaining != 0) { IntPtr funcPtr = _basePointer + pageEnd; MemoryManagement.Reprotect(funcPtr, (ulong)remaining, MemoryProtection.ReadWriteExecute); } }
private void curWindSSHandler() { ScSh = CurrentWindowScreenShot.CaptureCurrentWindow(); cwl(cc_lang[13]); cwl(cc_lang[14]); if (_sound) { sound.Play(); } DateTime now = DateTime.Now; string name = now.ToString("yyyy-MM-dd,hh-mm-ss") + "-Window"; string dateString = string.Format(@"{0}{1}", muc.Read("Main", "Path"), name + "." + muc.Read("Main", "Format")); cwl(cc_lang[20] + name); SasLabel.Text = cc_lang[11] + cc_lang[21] + ":" + Environment.NewLine + dateString; saveImage(dateString, ScSh, muc.Read("Main", "Format"), muc.ReadInt("Main", "jpgQuality")); pictureBox1.Image = ScSh; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; cwl(cc_lang[11] + cc_lang[21] + " " + dateString); cwl(cc_lang[16]); muc.Write("Main", "LastPath", dateString); if (lstButton.Visible == false) { cwl(cc_lang[22]); lstButton.Visible = true; } MemoryManagement.FlushMemory(); }
private void btnupdate_Click(object sender, EventArgs e) { try { if (txtCName.Text == string.Empty || txtCredit.Text == string.Empty || txtAmount.Text == string.Empty) { MessageBox.Show("Please enter valid data"); return; } decimal paid = Convert.ToDecimal(txtAmount.Text); if (globalForm.publicSales.UpdateCredit(con, paid)) { MemoryManagement.FlushMemory(); // this.Close(); MessageBox.Show("Credit amount has been deducted"); txtAmount.Clear(); txtCredit.Text = Convert.ToString(Convert.ToDecimal(txtCredit.Text) - paid); } } catch (Exception ex) { MetroMessageBox.Show(this, "! System Error . Code 104. " + ex.Message, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void WriteData(MemoryManagement.ManagedPointer ptr, byte[] data, int index, int length) { if (length > ptr.Size) { throw new IndexOutOfRangeException(); } base.InsertData(ptr.Offset, data, index, length); }
private void MainWindowShow() { Show(); TopMost = true; Thread.Sleep(1); TopMost = false; cwl(cc_lang[6] + " " + cc_lang[0] + ifru("о")); MemoryManagement.FlushMemory(); }
private void button1_Click(object sender, EventArgs e) { MemoryManagement.FlushMemory(); this.Close(); //this.Hide(); //var form2 = new ManageStock(); //form2.Closed += (s, args) => this.Dispose(); //form2.Show(); }
//method for opening loging window private void OpenLogingWIndow() { LoginWindow loginWindow = new LoginWindow() { Owner = this, }; loginWindow.LoginSuccedeed += LoginWindow_LoginSuccedeed; loginWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
//reaction for clicking creation of new user option from window menu private void MenuCreateNewUser_Click(object sender, RoutedEventArgs e) { CreateNewUser newUserCreationWindow = new CreateNewUser() { Owner = this, }; newUserCreationWindow.AdditionSuccedeed += NewUserCreationWindow_AdditionSuccedeed; newUserCreationWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
public void CheckMemory_1GUsed_ReturnsTrue() { // We'll grab some big chunks but not demand we can get it all. Keep them small enough to stay out of Large Object Heap var chunks = new List <byte[]>(); for (int i = 0; i < 21000; i++) { chunks.Add(new byte[50000]); } Assert.That(MemoryManagement.CheckMemory(true, "not much done", false), Is.True); }
private void SuitDemandingButton_Click(object sender, RoutedEventArgs e) { DemandTheSuitWindow suitDemandingWIndow = new DemandTheSuitWindow() { Owner = this, }; suitDemandingWIndow.SuitDemandingWindowClosing += SuitDemandingWIndow_SuitDemandingWindowClosing; suitDemandingWIndow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void metroTile3_Click(object sender, EventArgs e) { MemoryManagement.FlushMemory(); this.Hide(); var form2 = new ManageStock(); form2.Closed += (s, args) => this.Dispose(); form2.Show(); }
//method for handling with suit demanding window private void SuitDemandingWindowHandle() { jackOrAceInCardsToPutOnTheTable = true; Windows.DemandTheSuitWindow DemandingWindow = new DemandTheSuitWindow() { Owner = this, }; DemandingWindow.SuitDemandingWindowClosing += DemandingWindow_SuitDemandingWindowClosing; DemandingWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void RankDemandingButton_Click(object sender, RoutedEventArgs e) { DemandTheRankWindow rankDemandingWindow = new DemandTheRankWindow(topCard.Suit) { Owner = this, }; rankDemandingWindow.RankDemandingWindowClosing += RankDemandingWindow_RankDemandingWindowClosing; rankDemandingWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
//method for opening window with game results private void OpenEngGameResultsWindow(GameFinishedDataRequest inputData) { GameFinishedWindow EndingWindow = new GameFinishedWindow(inputData, thisPlayerID) { //Owner = this, }; EndingWindow.GameResultsWindowClosing += EndingWindow_GameResultsWindowClosing; EndingWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void ChangeJokerButton_Click(object sender, RoutedEventArgs e) { FirstCardJokerPermittedCardsSelection newJokerWindow = new FirstCardJokerPermittedCardsSelection(permittedCardsList) { Owner = this, }; newJokerWindow.NewJokerCard += NewJokerWindow_NewJokerCard; newJokerWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void pathLabel_MouseHover(object sender, EventArgs e) { if (muc.Read("Main", "Path") == "") { TooltipShow(cc_lang[52] + " " + cc_lang[33], pathLabel); } else { TooltipShow(cc_lang[52] + muc.Read("Main", "Path"), pathLabel); } MemoryManagement.FlushMemory(); }
//opening the settings window private void MenuSettings_Click(object sender, RoutedEventArgs e) { Windows.UserSettingsWindow settingsWindow = new UserSettingsWindow (SavedDataPlaceholder.CardsBackColor, SavedDataPlaceholder.JoiningTimeoutEnabled, SavedDataPlaceholder.JoiningTimeoutMinutesAmount, SavedDataPlaceholder.ReadinessTimeoutEnabled, SavedDataPlaceholder.ReadinessTimeoutMinutesAmount, SavedDataPlaceholder.LocationOfThirdPlayersCards) { Owner = this, }; settingsWindow.SettingsChanged += SettingsWindow_SettingsChanged; settingsWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void AdEndpointManuallyButton_Click(object sender, RoutedEventArgs e) { AddEndpointManuallyWindow endpointWindow = new AddEndpointManuallyWindow() { Owner = mainWindowInstance, }; endpointWindow.ManualHostInputed += EndpointWindow_ManualHostInputed; endpointWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
private void TooltipShow(string text, IWin32Window window) { if (muc.ReadBool("Main", "Tooltips") == true) { toolTip.Show(text, window); } else { toolTip.Hide(window); } MemoryManagement.FlushMemory(); }
private void ShowHideAbout() { if (About.Visible == true) { About.Hide(); } else { About.ShowDialog(); } MemoryManagement.FlushMemory(); }
//open new game window private void StartNewgameWindow(ThirdPlayerLocation location, PersonalizedForSpecificPlayerStartGameDataRequest data) { Windows.GameWindow gameWindow = new Windows.GameWindow(location, data, SavedDataPlaceholder.CardsBackColor) { Owner = this, }; gameWindow.WindowWasClosedByUser += GameWindow_WindowWasClosedByUser; gameWindow.GameWindowClosedByHost += GameWindow_GameWindowClosedByHost; gameWindow.ShowDialog(); MemoryManagement.FlushMemory(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Program p = new Program(); p.NonStaticMethod(); MemoryManagement.FlushMemory(); Application.Run(); }
public void CheckMemory_1GUsed_DisplaysDialogOnlyOnce() { // We'll grab some big chunks but not demand we can get it all. Keep them small enough to stay out of Large Object Heap var chunks = new List <byte[]>(); for (int i = 0; i < 21000; i++) { chunks.Add(new byte[50000]); } Assert.That(MemoryManagement.CheckMemory(true, "not much done", true), Is.True); // Doing it again should still return true, but you should NOT see the dialog twice. Assert.That(MemoryManagement.CheckMemory(true, "not much done", true), Is.True); }
public void CheckMemory_1GUsed_ReturnsTrue() { // We'll grab some big chunks but not demand we can get it all. Keep them small enough // to stay out of Large Object Heap var desiredNumberOfChunks = Is64BitProcess && HasLargePhysicalMemory ? 42000 : 21000; var chunks = new List <byte[]>(); for (int i = 0; i < desiredNumberOfChunks; i++) { chunks.Add(new byte[50000]); } Assert.That(MemoryManagement.CheckMemory(true, "not much done", false), Is.True, "CheckMemory didn't detect danger"); }
//method for opening window private void OpenMatchingCardInBattleWindow(PlayingCard newCard, PlayingCard topCard) { if (CardTakenInBattleModeMatches) { BattleCardWindow BattleWindow = new BattleCardWindow(newCard, topCard, GameStateData.CurrentStatusOfTheGame, GameStateData.CurrentlyDemandedRank, GameStateData.CurrentlyDemandedSuit) { Owner = this }; BattleWindow.CancelButtonClick += BattleWindow_CancelButtonClick; BattleWindow.ConfirmButtonClick += BattleWindow_ConfirmButtonClick; BattleWindow.ShowDialog(); MemoryManagement.FlushMemory(); } }
private void consButton_Click(object sender, EventArgs e) { if (cws == true) { cws = false; cwsw = false; SSConsoleHide(); } else { SSConsoleShow(); cws = true; cwsw = true; } MemoryManagement.FlushMemory(); }
public byte[] ReadData(MemoryManagement.ManagedPointer ptr) { return base.GetData(ptr.Offset, ptr.Size); }