public SubStateDifficultySelect(StateAbstract theparent) : base(theparent) { int i; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[6]; menu = new string[6]; menu[0] = "Child"; menu[1] = "Youth"; menu[2] = "Standard"; menu[3] = "Challenging"; menu[4] = "Expert"; menu[5] = "Insane"; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; colors[0] = Color.White; mX = 100; mY = 45; width = 900; height = 630; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
public SubStateConfirmEquipMenu(SubStateAbstract theparent, int xCoord, int yCoord, int thePC, int itemSlot, int itemLocation, int type) : base(theparent) { PCid = thePC; slot = itemSlot; itemID = itemLocation; itemType = type; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[2]; menu = new string[2]; menu[0] = "Yes"; menu[1] = "No"; colors[0] = Color.White; colors[1] = Color.DarkGray; mX = xCoord; mY = yCoord; width = 27; height = 50; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true); }
void Start() { // Stop reorientation weirdness // http://answers.unity3d.com/questions/14655/unity-iphone-black-rect-when-i-turn-the-iphone Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToLandscapeLeft = false; sounds = new Sounds(gameObject); sounds.Start(); var loopTracker = new LoopTracker(sounds); var textLabel = new GameObject("prompt text"); textLabel.SetActive(false); var text = textLabel.AddComponent<GUIText>(); textLabel.transform.position = new Vector3(0f, 0.06f, -9.5f); var font = (Font) Resources.Load("sierra_agi_font/sierra_agi_font", typeof(Font)); text.font = font; messageBox = new MessageBox(font); var prompt = new Prompt(textLabel, text).build(); sceneManager = new SceneManager(loopTracker, new MessagePromptCoordinator(prompt, messageBox)); }
protected override void Start() { if (email == null || recover == null) { Debug.LogWarning ("UIRecoverPassword: Please assign all fields in the inspector."); return; } if (LoginSystem.current == null) { Debug.LogWarning("UIRecoverPassword: Requires a LoginSystem. Create one from Tools > Unitycoding > Login System > Login System!"); return; } if (LoginSystem.Settings == null) { Debug.LogWarning("[LoginSystem(UIRecoverPassword)] Please assign LoginSettings to the Login Systtem!"); return; } messageBox = UIWindow.Get<MessageBox> (LoginSystem.Settings.messageBoxWindow); if (messageBox == null) { Debug.LogWarning("[LoginSystem(UIRecoverPassword)] No message box found with name " + LoginSystem.Settings.messageBoxWindow+"!"); return; } loginWindow = UIWindow.Get<UILogin> (LoginSystem.Settings.loginWindow); if (loginWindow == null) { Debug.LogWarning("[LoginSystem(UIRecoverPassword)] No login window found with name " + LoginSystem.Settings.loginWindow+"!"); return; } LoginSystem.current.RegisterListener ("OnPasswordRecovered", OnPasswordRecovered); LoginSystem.current.RegisterListener ("OnFailedToRecoverPassword", OnFailedToRecoverPassword); recover.onClick.AddListener (RecoverPasswordUsingFields); }
public ChangeMCVersion() { InitializeComponent(); try { foreach (TinyMinecraftVersion ver in VersionManager.versions) { ListBoxItem item = new ListBoxItem(); item.Content = ver.Key; item.Tag = ver; if (ver.Type == ReleaseType.release) lb_release.Items.Add(item); else if (ver.Type == ReleaseType.snapshot) lb_snapshot.Items.Add(item); else lb_instance.Items.Add(item); } } catch { MessageBox mb = new MessageBox("Warning!","The versions haven't initialized yet"); mb.Show(); this.Close(); } }
internal BattleGUI(ScreenConstants screen, GUIManager manager, Dialog messageFrame, MessageBox messageBox, IMenuWidget<MainMenuEntries> mainWidget, IMenuWidget<Move> moveWidget, IMenuWidget<Pokemon> pokemonWidget, IMenuWidget<Item> itemWidget, IBattleStateService battleState, BattleData data) { this.battleState = battleState; playerId = data.PlayerId; ai = data.Clients.First(id => !id.IsPlayer); this.moveWidget = moveWidget; this.itemWidget = itemWidget; this.mainWidget = mainWidget; this.pokemonWidget = pokemonWidget; this.messageBox = messageBox; this.messageFrame = messageFrame; InitMessageBox(screen, manager); InitMainMenu(screen, manager); InitAttackMenu(screen, manager); InitItemMenu(screen, manager); InitPKMNMenu(screen, manager); }
public SubStateSpellSelect(StateAbstract theparent, SpellAbstract[] theSpells, PC thePC) : base(theparent) { spells = theSpells; curr = thePC; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; int i; colors = new Color[spells.Length]; menu = new string[spells.Length]; for (i = 0; i < spells.Length && spells[i] != null; i++) menu[i] = spells[i].Name; for (; i < spells.Length; i++) menu[i] = ""; if (colors.Length > 0) colors[0] = Color.White; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; mX = 190; mY = 75; width = 780; height = 570; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
public SubStateOptionsMenu(StateAbstract theparent) : base(theparent) { int i; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[1]; menu = new string[colors.Length]; colors[0] = Color.White; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; menu[0] = "Difficulty"; for (i = 1; i < menu.Length; i++) menu[i] = "Option " + i; mX = 100; mY = 45; width = 900; height = 630; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
/// <summary> /// /// </summary> /// <param name="pInfo">Mensagem</param> /// <param name="pPageRedirect">Pagina Redirecionada</param> /// <param name="type">Tipo de Mensagem. 1 - information; 2 - warning; 3 - erro;</param> public void wuc_ShowMessage(string pInfo, string pPageRedirect, int type) { string appPath = HttpContext.Current.Request.ApplicationPath; string physicalPath = HttpContext.Current.Request.MapPath(appPath); MessageBox msgbox = new MessageBox(physicalPath + "\\Resources\\Config\\msgbox.txt"); msgbox.SetMessage(pInfo); switch (type) { case 1: msgbox.SetTitle("Informação"); if (appPath.ToString() != "/") msgbox.SetIcon(appPath + "/Resources/Img/information.png"); else msgbox.SetIcon("/Resources/Img/information.png"); break; case 2: msgbox.SetTitle("Atenção"); if (appPath.ToString() != "/") msgbox.SetIcon(appPath + "/Resources/Img/warning.png"); else msgbox.SetIcon("/Resources/Img/warning.png"); break; case 3: msgbox.SetTitle("Error"); if (appPath.ToString() != "/") msgbox.SetIcon(appPath + "/Resources/Img/error.png"); else msgbox.SetIcon("/Resources/Img/error.png"); break; } msgboxpanel.Visible = true; msgbox.SetOKButton("msg_button_class", pPageRedirect); msgboxpanel.InnerHtml = msgbox.ReturnObject(); }
void Start () { var messageBox = new MessageBox (); var trialUpgradeButton = new MessageBox.Command ("Trial Upgrade", trialUpgrade); var productPurchaseButton = new MessageBox.Command ("In app purchase", productPurchase); messageBox.ShowMessageBox ("Which scenario would you like to test?", "Store plugin test", trialUpgradeButton, productPurchaseButton); // Initialize the Store proxy on debug builds Store.DebugApp debugapp = new Store.DebugApp(); debugapp.Name = "WinControls debug harness"; debugapp.Price = 5.99; debugapp.IsTrial = false; debugapp.IsActive = true; Store.DebugProduct bigsword = new Store.DebugProduct(); bigsword.ProductId = "bigsword"; bigsword.Name = "really big swordy!"; bigsword.Price = 99.99; Store.DebugProduct bigaxe = new Store.DebugProduct(); bigaxe.ProductId = "bigaxe"; bigaxe.Name = "really big axe!"; bigaxe.Price = 65.99; bigaxe.IsActive = true; Store.EnableDebugWindowsStoreProxy (handleLicenseChanged, debugapp, bigsword, bigaxe); }
/// <summary> /// handle load event /// </summary> protected void Page_Load(object sender, EventArgs e) { employees = db.Employees; // only perform on page load if (!Page.IsPostBack) { // catch any database exceptions try { // table databinding refreshDataBinding(); //set the login id lblUsername.Text = Page.User.Identity.Name; } catch (Exception) { // display messagebox string title = "My box title goes here"; string text = "Do you want to Update this record?"; // use my custom messagebox class MessageBox messageBox = new MessageBox(text, title, MessageBox.MessageBoxIcons.Question, MessageBox.MessageBoxButtons.YesOrNo, MessageBox.MessageBoxStyle.StyleA); messageBox.SuccessEvent.Add("YesModClick"); // set text of asp:Literal#PopupBox in the aspx file PopupBox.Text = messageBox.Show(this); } } }
public SubStateRuneSelect(StateAbstract theparent, Character thePC) : base(theparent) { curr = (PC) thePC; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; int i, size = calcSize(); colors = new Color[size]; menu = new string[size]; for (i = 0; i < size; i++) menu[i] = curr.runes[i].Name; for (; i < size; i++) menu[i] = ""; if(colors.Length > 0) colors[0] = Color.White; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; mX = 100; mY = 45; width = 900; height = 630; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
public override void Awake() { base.Awake(); gameObject.SetActive(false); contentPanel = (RectTransform)transform.Find("ContentPanel"); scroller = transform.Find("Scrollbar").GetComponent<Scrollbar>(); messageBox = new MessageBox(transform.Find("MessageBox")); scroller.onValueChanged.AddListener(delegate(float value) { float screenHeight = Screen.height; float screenWidth = Screen.width; float allHeight = contentPanel.rect.height - screenHeight + 50f; float allWidth = contentPanel.rect.width; float yPos = value * -allHeight + allHeight / 2f + screenHeight / 2f; float xPos = (screenWidth - allWidth) / 2f + allWidth / 2; contentPanel.position = new UnityEngine.Vector2(xPos, yPos); }); RectTransform userInfoPanel = (RectTransform)contentPanel.Find("UserInfoPanel"); firstNameText = userInfoPanel.Find("UserNameText").GetComponent<Text>(); secondNameText = userInfoPanel.Find("UserLavelText").GetComponent<Text>(); userIconImage = userInfoPanel.Find("UserIcon").GetComponent<Image>(); avalableGamesPanel = (RectTransform)contentPanel.Find("AvalableGamesPanel"); }
public SubStateCharSelectMenuRune(SubStateAbstract theparent) : base(theparent) { parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[3]; menu = new string[3]; menu[0] = StateHandler.GetPC(0).Name; menu[1] = StateHandler.GetPC(1).Name; menu[2] = StateHandler.GetPC(2).Name; colors[0] = Color.White; colors[1] = Color.DarkGray; colors[2] = Color.DarkGray; mX = 100; mY = 45; width = 860; height = 590; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true); }
public Gui(Viewport viewport) { this.viewport = viewport; mainMenu = new MainMenu(viewport); //for developing only, later it will be moved somewhere and rewritten messageBox = new MessageBox(viewport); }
public GameplayScreen() { _state = GameState.PlayerTurn; _messageBox = _messageBox = new MessageBox(new Vector2(0, 628)); Announcer.Instance.Announcement += new Announcer.AnnouncementEvent(AddAnnouncement); _world = new World(); _world.AchievementUnlocked += new World.AchievementEvent(AchievementUnlocked); _user = new User(); _user.UserInputReceived += new User.UserInput(UserInputReceived); _sideBar = new SideBar(new Vector2(919, 0), ref _world.Player); _inventory = new Inventory(new Vector2(10, 30), _world.Player.Inventory); _spells = new SpellBook(new Vector2(10, 400), _world.Player.Spells); Camera.SetWorldSize(_world.GetWorldSize().X + 120, _world.GetWorldSize().Y + 300); _mouse = new MouseHelper(); _mouse.MouseButtonReleased += new MouseHelper.MouseButtonEventEvent(MouseButtonReleased); _achievementNotifications = new List<AchievementNotifier>(); _miniMap = new MiniMap(new Vector2(824, 428), _world); GameReference.Game.IsMouseVisible = true; _timeOfLastMouseMovement = new TimeSpan(); _previousMouseState = Mouse.GetState(); _availableTargets = new List<ICreature>(); _currentTargetIndex = 0; _targetImage = ContentHelper.Content.Load<Texture2D>("target"); }
public SubStateSlotMenuRune(SubStateAbstract theparent, int thePC) : base(theparent) { PCid = thePC; absolute = false; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[2]; menu = new string[2]; for (int i = 0; i < 2; i++) { if (StateHandler.GetPC(thePC).GetRune(i) == null) menu[i] = "Open"; else menu[i] = StateHandler.GetPC(thePC).GetRune(i).Name; colors[i] = Color.DarkGray; } colors[0] = Color.White; mX = 170; mY = 60; width = 760; height = 490; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true); }
public MessageBoxTests() { _httpContext = TestHelper.CreateMockedHttpContext(); _viewContext = new ViewContext { HttpContext = _httpContext.Object, ViewData = new ViewDataDictionary() }; _messageBox = new MessageBox(_viewContext, new Mock<IClientSideObjectWriterFactory>().Object) { AssetKey = jQueryViewComponentFactory.DefaultAssetKey }; }
public static void Show(string text) { MessageBox mb = new MessageBox(); mb.lblText.Text = text; MainForm.Enabled = false; mb.Show(MainForm); mb.Location = new Point((MainForm.Width / 2) - (mb.Width / 2), (MainForm.Height / 2) - (mb.Height / 2)); }
public BattleGUI(ScreenConstants screen, GUIManager manager, Dialog messageFrame, MessageBox messageBox, MainMenuWidget mainWidget, MoveMenuWidget moveWidget, PokemonMenuWidget pokemonWidget, ItemMenuWidget itemWidget, IBattleStateService battleState, BattleData data) : this(screen, manager, messageFrame, messageBox, (IMenuWidget<MainMenuEntries>)mainWidget, moveWidget, pokemonWidget, itemWidget, battleState, data) {}
protected virtual void Awake() { msgBox = GameObject.FindObjectOfType<MessageBox>(); PlayerData.instance.CheckInstance(); this.name = this.name.Remove(this.name.IndexOf("(")); // (Clone) 문자열 삭제 amount = PlayerData.instance.itemStorage[name]; }
public ClientScreen() { qR = new QuadRenderer(); clientBox = new MessageBox(10, 0, 0); serverBox = new MessageBox(10, 624, 0); serverBox.IsVisible = false; clientBox.IsVisible = false; clientState = ClientState.currentInstance; }
public MenuScreen() { lastState = new KeyboardState(); lastMouseState = new MouseState(); Game1.KeyboardBuffer.Enabled = true; serverRect = new Rectangle(50, 668, 120, 50); connectRect = new Rectangle(Game1.width - 170, 668, 120, 50); serverBox = new MessageBox(8, 0, 0); clientBox = new MessageBox(8, Game1.width - 400, 0); }
public Faceless(Texture2D sprite, Texture2D speechSprite, Vector2 pos, FacelessType type) { Position = pos; Sprite = sprite; Type = type; SourceRect = new Rectangle(0, HEIGHT * (int)Type, WIDTH, HEIGHT); DestRect = new Rectangle((int)pos.X, (int)pos.Y, WIDTH, HEIGHT); messageBox = new MessageBox(speechSprite, new Vector2(DestRect.X + DestRect.Width, DestRect.Y - 100), MessageBoxOffset * (int)Type, 8); }
public override void Setup(float startTime) { originalBGColor = Camera.main.backgroundColor; Camera.main.backgroundColor = Color.black; touch = new TouchSensor(input, new GameObjectFinder()); var layout = GameObject.Find("Layout").GetComponent<Layout>(); messageBox = layout.messageBox; messageBox.setMessage("Insert Disk 2"); messageBox.show(); }
public YesButton(Rectangle containerRectangle, MessageBox sender) { Text = "Yes"; int width = 19 * 5; int height = 6 * 5; int x = containerRectangle.X + containerRectangle.Width / 2; int y = containerRectangle.Y + containerRectangle.Height; CollRectangle = new Rectangle(x - width / 2, y - height - 20, width, height); this._sender = sender; Initialize(); }
/// <summary> /// Show user box /// </summary> /// <param name="message"></param> /// <param name="yes"></param> /// <param name="no"></param> /// <returns></returns> public static YesNo Show(string message, string yes, string no) { if (userBox == null) userBox = new MessageBox(); userBox.userTextBox.Text = message; userBox.yesBtn.Text = yes; userBox.noBtn.Text = no; userBox.ShowDialog(); return yesno; }
public void Awake() { state = States.NotStarted; RectTransform contentPanel = (RectTransform)transform.Find("Content"); splashBackground = contentPanel.GetComponent<Image>(); splashImage = contentPanel.Find("Image").GetComponent<Image>(); splashText = contentPanel.Find("Message").GetComponent<Text>(); loadingProgressBar = new ProgressBar(contentPanel.Find("LoadingBar"),0, 100); messageBox = new MessageBox(transform.Find("MessageBox")); }
public void Awake() { Self = this; Group = GetComponent<CanvasGroup>(); PanelImage = GetComponent<Image>(); Text = transform.Find("Text").gameObject.GetComponent<Text>(); Button = transform.Find("Button").gameObject.GetComponent<Button>(); ButtonImage = transform.Find("Button").gameObject.GetComponent<Image>(); ButtonText = transform.Find("Button/Text").gameObject.GetComponent<Text>(); SetVisible(false); }
void Awake() { if (i == null) { i = this; if (dontDestroy) DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public static List<Equipments> GetEquipments() //считывание файла оборудования xml { Char separator = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0]; System.Globalization.NumberStyles style; System.Globalization.CultureInfo culture; style = System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.AllowCurrencySymbol; culture = System.Globalization.CultureInfo.CurrentUICulture; //string pathFile = @"../../Xmls/equipments.xml"; if (!File.Exists(Helper.pathFile)) //если файл не найден { MessageBox.Show("File equipments " + Helper.pathFile + " not found"); return null; } else { try { List<Equipments> equipments = new List<Equipments>(); XmlDocument xDoc = new XmlDocument(); xDoc.Load(Helper.pathFile); XmlElement xRoot = xDoc.DocumentElement; foreach (XmlElement xnode in xRoot) { Equipments equipment = new Equipments(); equipment.Xml = xDoc; equipment.XmlIndex = xnode.GetHashCode(); foreach (XmlNode childnode in xnode.ChildNodes) { if (childnode.Name == "type") { equipment.Type = childnode.InnerText; } if (childnode.Name == "name") { equipment.Name = childnode.InnerText; } if (childnode.Name == "ImageName") { equipment.ImageName = childnode.InnerText; if (string.IsNullOrEmpty(equipment.ImageName)) { equipment.ImageName = "notfound"; } } if (childnode.Name == "Volume") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.Volume = result; } else { MessageBox.Show("Значение тега Volume неверно ", "Ошибка"); equipment.Volume = 0; } } if (childnode.Name == "Mass") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.Mass = result; } else { MessageBox.Show("Значение тега Mass неверно ", "Ошибка"); equipment.Mass = 0; } } if (childnode.Name == "Power") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.Power = result; } else { MessageBox.Show("Значение тега Power неверно ", "Ошибка"); equipment.Power = 0; } } if (childnode.Name == "Coeff") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.Coeff = result; } else { MessageBox.Show("Значение тега Coeff неверно ", "Ошибка"); equipment.Coeff = 0; } } if (childnode.Name == "W") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.W = result; } else { MessageBox.Show("Значение тега a неверно ", "Ошибка"); equipment.W = 0; } } if (childnode.Name == "a") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.a = result; } else { MessageBox.Show("Значение тега a неверно ", "Ошибка"); equipment.a = 0; } } if (childnode.Name == "Pressure") { equipment.Pressure = childnode.InnerText; } if (childnode.Name == "Temperature") { equipment.Temperature = childnode.InnerText; } if (childnode.Name == "Rotation") { equipment.Rotation = childnode.InnerText; } if (childnode.Name == "Storage") { equipment.Storage = childnode.InnerText; } if (childnode.Name == "Performance") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { equipment.Performance = result; } else { MessageBox.Show("Значение тега Performance неверно ", "Ошибка"); equipment.Performance = 0; } } } equipments.Add(equipment); } return equipments; } catch (Exception exc) { MessageBox.Show("Ошибка чтения файла. \n " + exc.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } } }
// Muestra error en caso de que haya un campo vacio private void campBuit() { MessageBox.Show("Completa el camp buit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { // a box will pop up when the user clicks on the about section of the help menu MessageBox.Show("Developer: James Patterson,\nSoftware: Visual Studio 2018\nDetails: C# Windows Form Application\n", "About"); }
private void Decompress7Zip(string path, string fileName) { SevenZipExtractor.SetLibraryPath("7zxa.dll"); new SevenZipExtractor(path + fileName).ExtractArchive(path); MessageBox.Show("Download successfully", "Download successfully. Restart Wox to apply. 下载成功!请重启 Wox 来使用词典。"); }
//Muestra error en caso de que el archivo no sea una imagen private void errorImatge() { MessageBox.Show("El arxiu seleccionat no es una imatge"); }
/// <summary> /// 検索ボタンクリック /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { try { if (this.CheckAllValidation() != true) { MessageBox.Show("入力エラーがあります。"); return; } string pickup支払先 = this.支払先ピックアップ; int? p支払先FROM; int? p支払先TO; int? p締日; int? p作成年月; DateTime p作成年月日; if (string.IsNullOrWhiteSpace(this.支払先範囲指定From)) { p支払先FROM = null; } else { p支払先FROM = AppCommon.IntParse(this.支払先範囲指定From); } if (string.IsNullOrWhiteSpace(this.支払先範囲指定To)) { p支払先TO = null; } else { p支払先TO = AppCommon.IntParse(this.支払先範囲指定To); } if (string.IsNullOrWhiteSpace(this.作成締日)) { p締日 = null; } else { p締日 = AppCommon.IntParse(this.作成締日); } if (string.IsNullOrWhiteSpace(this.作成年月)) { MessageBox.Show("入力エラーがあります。"); return; } else { DateTime Wk; p作成年月日 = DateTime.TryParse(this.作成年月, out Wk) ? Wk : DateTime.Today; p作成年月 = p作成年月日.Year * 100 + p作成年月日.Month; } //支払先リスト作成 int?[] i支払先List = new int?[0]; if (!string.IsNullOrEmpty(支払先ピックアップ)) { string[] 支払先List = 支払先ピックアップ.Split(','); i支払先List = new int?[支払先List.Length]; for (int i = 0; i < 支払先List.Length; i++) { string str = 支払先List[i]; int code; if (!int.TryParse(str, out code)) { this.ErrorMessage = "支払先指定の形式が不正です。"; return; } i支払先List[i] = code; } } base.SendRequest(new CommunicationObject(MessageType.RequestData, SHR04010_KIKAN_SET, 支払先ピックアップ, i支払先List, p支払先FROM, p支払先TO, p締日, p作成年月, p作成年月日, 計算期間の再計算)); } catch (Exception) { return; } }
private void Timer1_Tick(object sender, EventArgs e) { if (timeLeft <= fullTime * 0.6 && timeLeft > fullTime * 0.3) { timeLeftVar.ForeColor = Color.Orange; } else if (timeLeft <= fullTime * 0.3 && timeLeft > 0) { timeLeftVar.ForeColor = Color.Red; } if (CheckAnswers()) { timer1.Stop(); if (level != 22) { level++; startButton.Text = "Generate level " + (level + 1).ToString(); comboStreak++; comboVal.Text = comboStreak.ToString(); } else { startButton.Text = "Regenerate"; comboStreak++; comboVal.Text = comboStreak.ToString(); } if (level != 22) { } else if (firstTime == false) { } else { MessageBox.Show("Maximum level was reached."); firstTime = false; comboVal.Text = comboStreak.ToString(); } startButton.Focus(); gameQuit.TabIndex = 1; startButton.Enabled = true; gameQuit.TabStop = true; } else if (timeLeft > 0) { timeLeft -= 0.1; timeLeftVar.Text = ((int)timeLeft).ToString(); } else { timer1.Stop(); lives--; comboStreak = 0; comboVal.Text = comboStreak.ToString(); livesVal.Text = lives.ToString(); gameQuit.TabIndex = 1; startButton.Enabled = true; gameQuit.TabStop = true; timeLeftVar.Text = "0"; if (lives == 0) { MessageBox.Show("Game over. You've scored " + score.ToString() + " points."); score = 0; scoreVal.Text = score.ToString(); level = 0; levelVar.Text = level.ToString(); lives = 3; startButton.Text = "Restart (level 1)"; } else if (level != 22) { startButton.Text = "Generate level " + (level + 1).ToString(); } else if (level == 22) { startButton.Text = "Regenerate"; } answer1.Value = befCube1; answer2.Value = befCube2; answer3.Value = befCube3; answer4.Value = befCube4; answer5.Value = befCube5; } }
// TODO void CloseAllImages(object sender, EventArgs eventArgs) => MessageBox.Show("Not yet implemented");
public bool Inject(string dllPath, int pid) { bool result = false; IntPtr processHandle = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, false, (uint) pid); if (processHandle == IntPtr.Zero) { MessageBox.Show("Failed to open valid process handle!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return result; } byte[] asciiDllPath = Encoding.ASCII.GetBytes((dllPath + "\0")); byte[] asciiKernel32DLL = Encoding.ASCII.GetBytes("kernel32.dll\0"); byte[] asciiLoadLibraryA = Encoding.ASCII.GetBytes("LoadLibraryA\0"); IntPtr dllPathBuffer = Marshal.AllocHGlobal(asciiDllPath.Length); IntPtr kernel32Buffer = Marshal.AllocHGlobal(asciiKernel32DLL.Length); IntPtr loadLibraryABuffer = Marshal.AllocHGlobal(asciiLoadLibraryA.Length); Marshal.Copy(asciiDllPath, 0, dllPathBuffer, asciiDllPath.Length); Marshal.Copy(asciiKernel32DLL, 0, kernel32Buffer, asciiKernel32DLL.Length); Marshal.Copy(asciiLoadLibraryA, 0, loadLibraryABuffer, asciiLoadLibraryA.Length); IntPtr kernel32Base = LoadLibraryA(kernel32Buffer); if (kernel32Base != IntPtr.Zero) { IntPtr loadLibraryAddr = GetProcAddress(kernel32Base, loadLibraryABuffer); if (loadLibraryAddr != IntPtr.Zero) { IntPtr remoteAddress = VirtualAllocEx(processHandle, IntPtr.Zero, (uint) asciiDllPath.Length, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (remoteAddress != IntPtr.Zero) { uint written; if (WriteProcessMemory(processHandle, remoteAddress, dllPathBuffer, (uint) asciiDllPath.Length, out written)) { IntPtr remoteThread = CreateRemoteThread(processHandle, IntPtr.Zero, 0, loadLibraryAddr, remoteAddress, 0, IntPtr.Zero); if (remoteThread != IntPtr.Zero) { CloseHandle(remoteThread); VirtualFreeEx(processHandle, remoteAddress, (uint) asciiDllPath.Length, MEM_RELEASE); result = true; } else { MessageBox.Show("Failed to create remote thread!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Failed to write data to remote process!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Failed to allocate memory in remote process!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Failed to get kernel32.dll!LoadLibraryA address!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Failed to get kernel32.dll base address!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } CloseHandle(processHandle); Marshal.FreeHGlobal(dllPathBuffer); Marshal.FreeHGlobal(kernel32Buffer); Marshal.FreeHGlobal(loadLibraryABuffer); return result; }
private void btn_Weight_Click(object sender, EventArgs e) { this.Enabled = false; Cursor.Current = Cursors.WaitCursor; try { if (Open()) { Thread.Sleep(100); if (serialPort1.IsOpen) { //int nReadLen; //Thread.Sleep(200); //nReadLen = serialPort1.Read(byRead, 0, byRead.Length); //string str = System.Text.Encoding.Default.GetString(byRead); Thread.Sleep(100); byte[] byRead = new byte[serialPort1.ReadBufferSize]; int nReadLen = serialPort1.Read(byRead, 0, byRead.Length); string str = System.Text.Encoding.Default.GetString(byRead); //MessageBox.Show(str); //MessageBox.Show(str.Length.ToString()); string[] strWeight = str.Split('='); int nLen = strWeight.Length; //MessageBox.Show(nLen.ToString()); if (nLen > 1) { //if (strWeight[nLen - 3].ToString() == strWeight[nLen - 2].ToString() && strWeight[nLen - 4].ToString() == strWeight[nLen - 2].ToString()) //{ char[] arr = strWeight[nLen - 1].Substring(0, 7).ToCharArray(); Array.Reverse(arr); txtQty.Text = decimal.Parse(new string(arr)).ToString(); ; //ZH(strWeight[nLen - 1].ToString()); //} //else //{ //MessageBox.Show("串口没有打开"); //} Close(); Thread.Sleep(100); this.Enabled = true; Cursor.Current = Cursors.Default; } else { MessageBox.Show(str); Close(); Thread.Sleep(100); this.Enabled = true; Cursor.Current = Cursors.Default; } //MessageBox.Show(str); } else { this.Enabled = true; Cursor.Current = Cursors.Default; MessageBox.Show("串口没有打开"); } Close(); this.Enabled = true; Cursor.Current = Cursors.Default; } else { this.Enabled = true; Cursor.Current = Cursors.Default; } } catch (Exception ex) { this.Enabled = true; Cursor.Current = Cursors.Default; MessageBox.Show(ex.ToString()); } }
protected void OnMenuOpen(object sender, EventArgs e) { // TODO: Extensions var dlgOpenImage = new OpenFileDialog { Title = "Choose image to open" }; DialogResult result = dlgOpenImage.ShowDialog(this); if(result != DialogResult.Ok) return; var filtersList = new FiltersList(); IFilter inputFilter = filtersList.GetFilter(dlgOpenImage.FileName); if(inputFilter == null) { MessageBox.Show("Cannot open specified file.", MessageBoxType.Error); return; } try { IMediaImage imageFormat = ImageFormat.Detect(inputFilter); if(imageFormat == null) { MessageBox.Show("Image format not identified.", MessageBoxType.Error); return; } DicConsole.WriteLine("Image format identified by {0} ({1}).", imageFormat.Name, imageFormat.Id); try { if(!imageFormat.Open(inputFilter)) { MessageBox.Show("Unable to open image format", MessageBoxType.Error); DicConsole.ErrorWriteLine("Unable to open image format"); DicConsole.ErrorWriteLine("No error given"); return; } // TODO: SVG Stream logo = ResourceHandler. GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.png"); var imageGridItem = new TreeGridItem { Values = new object[] { logo == null ? null : new Bitmap(logo), $"{Path.GetFileName(dlgOpenImage.FileName)} ({imageFormat.Info.MediaType})", dlgOpenImage.FileName, new pnlImageInfo(dlgOpenImage.FileName, inputFilter, imageFormat), inputFilter, imageFormat } }; List<Partition> partitions = Core.Partitions.GetAll(imageFormat); Core.Partitions.AddSchemesToStats(partitions); bool checkraw = false; List<string> idPlugins; IFilesystem plugin; PluginBase plugins = GetPluginBase.Instance; if(partitions.Count == 0) { DicConsole.DebugWriteLine("Analyze command", "No partitions found"); checkraw = true; } else { DicConsole.WriteLine("{0} partitions found.", partitions.Count); foreach(string scheme in partitions.Select(p => p.Scheme).Distinct().OrderBy(s => s)) { var schemeGridItem = new TreeGridItem { Values = new object[] { nullImage, // TODO: Add icons to partition schemes scheme } }; foreach(Partition partition in partitions. Where(p => p.Scheme == scheme).OrderBy(p => p.Start)) { var partitionGridItem = new TreeGridItem { Values = new object[] { nullImage, // TODO: Add icons to partition schemes $"{partition.Name} ({partition.Type})", null, new pnlPartition(partition) } }; DicConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(imageFormat, out idPlugins, partition); if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else { DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { plugin.GetInformation(imageFormat, partition, out string information, null); var fsPlugin = plugin as IReadOnlyFilesystem; if(fsPlugin != null) { Errno error = fsPlugin.Mount(imageFormat, partition, null, new Dictionary<string, string>(), null); if(error != Errno.NoError) fsPlugin = null; } var filesystemGridItem = new TreeGridItem { Values = new object[] { nullImage, // TODO: Add icons to filesystems plugin.XmlFsType.VolumeName is null ? $"{plugin.XmlFsType.Type}" : $"{plugin.XmlFsType.VolumeName} ({plugin.XmlFsType.Type})", fsPlugin, new pnlFilesystem(plugin.XmlFsType, information) } }; if(fsPlugin != null) { Statistics.AddCommand("ls"); filesystemGridItem.Children.Add(placeholderItem); } Statistics.AddFilesystem(plugin.XmlFsType.Type); partitionGridItem.Children.Add(filesystemGridItem); } } schemeGridItem.Children.Add(partitionGridItem); } imageGridItem.Children.Add(schemeGridItem); } } if(checkraw) { var wholePart = new Partition { Name = "Whole device", Length = imageFormat.Info.Sectors, Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize }; Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart); if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else { DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { plugin.GetInformation(imageFormat, wholePart, out string information, null); var fsPlugin = plugin as IReadOnlyFilesystem; if(fsPlugin != null) { Errno error = fsPlugin.Mount(imageFormat, wholePart, null, new Dictionary<string, string>(), null); if(error != Errno.NoError) fsPlugin = null; } var filesystemGridItem = new TreeGridItem { Values = new object[] { nullImage, // TODO: Add icons to filesystems plugin.XmlFsType.VolumeName is null ? $"{plugin.XmlFsType.Type}" : $"{plugin.XmlFsType.VolumeName} ({plugin.XmlFsType.Type})", fsPlugin, new pnlFilesystem(plugin.XmlFsType, information) } }; if(fsPlugin != null) { Statistics.AddCommand("ls"); filesystemGridItem.Children.Add(placeholderItem); } Statistics.AddFilesystem(plugin.XmlFsType.Type); imageGridItem.Children.Add(filesystemGridItem); } } } imagesRoot.Children.Add(imageGridItem); treeImages.ReloadData(); Statistics.AddMediaFormat(imageFormat.Format); Statistics.AddMedia(imageFormat.Info.MediaType, false); Statistics.AddFilter(inputFilter.Name); }
private void btnGO_Click(object sender, EventArgs e) { BuildFiles bf; LanguageType CodeChoice; BuildFiles.VS_Version Version = BuildFiles.VS_Version.v2010; string FileName; string FilePath; Cursor = Cursors.WaitCursor; if (rdoCS.Checked) { CodeChoice = LanguageType.CSharp; } else { CodeChoice = LanguageType.VB; } if (rdo2008.Checked) { Version = BuildFiles.VS_Version.v2008; } else if (rdo2010.Checked) { Version = BuildFiles.VS_Version.v2010; } FilePath = txtOutputDir.Text; if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } FilePath = txtOutputDir.Text + "\\" + Constant.NameRoot; if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } bf = new BuildFiles(Version); UI presentation = new UI(Constant.NameRoot); presentation.Language = CodeChoice; presentation.Create(Constant.NamePrefix + "_" + Constant.NameRoot); FileName = presentation.FileNameCode; using (System.IO.StreamWriter outputFile = new System.IO.StreamWriter(FilePath + "\\" + FileName)) outputFile.Write(presentation.Body); bf.AddFile(FileName, BuildFiles.CodeFileType.Form); FileName = presentation.FileNameDesigner; using (System.IO.StreamWriter outputFile = new System.IO.StreamWriter(FilePath + "\\" + FileName)) outputFile.Write(presentation.BodyDesigner); FileName = presentation.FileNameProgram; using (System.IO.StreamWriter outputFile = new System.IO.StreamWriter(FilePath + "\\" + FileName)) outputFile.Write(presentation.Program); bf.AddFile(FileName, BuildFiles.CodeFileType.Program); FileName = presentation.FileNameResourceForm; using (System.IO.StreamWriter outputFile = new System.IO.StreamWriter(FilePath + "\\" + FileName)) outputFile.Write(presentation.ResourceForm); bf.AddFile(FileName, BuildFiles.CodeFileType.Resource, presentation.FileNameCode); bf.Name = Constant.NameRoot; bf.Path = FilePath; bf.Language = CodeChoice; //bf.TypePrefix = "frm"; bf.BuildSolutionFile(); bf.BuildAssemblyInfo(Constant.NameRoot, Constant.NamePrefix); bf.BuildProjectFile(Constant.NamePrefix + "_" + Constant.NameRoot); Cursor = Cursors.Default; MessageBox.Show("Done!"); }
void deleteJobMenuItem_Click(object sender, RoutedEventArgs e) { object selectedItem = this.SyncHistoryListBox.SelectedItem; if (selectedItem != null) { string jobId = this.syncRecordDict[(ListBoxItem)selectedItem]; SyncSetting syncSetting = SyncSetting.LoadSyncSettingByJobId(jobId); if (syncSetting != null) { MessageBoxResult mbr = MessageBox.Show( string.Format("确认删除同步任务 {0} -> {1} 么?", syncSetting.SyncLocalDir, syncSetting.SyncTargetBucket), "删除任务", MessageBoxButton.YesNo, MessageBoxImage.Question); if (mbr.Equals(MessageBoxResult.Yes)) { //delete job related files string[] filesToDelete ={ Path.Combine(this.myAppPath,"logs",jobId,"error.log"), Path.Combine(this.myAppPath,"logs",jobId,"exists.log"), Path.Combine(this.myAppPath,"logs",jobId,"not_overwrite.log"), Path.Combine(this.myAppPath,"logs",jobId,"overwrite.log"), Path.Combine(this.myAppPath,"logs",jobId,"skipped.log"), Path.Combine(this.myAppPath,"logs",jobId,"success.log"), Path.Combine(this.myAppPath,"synclog",jobId+".log.db"), Path.Combine(this.myAppPath,"dircache",jobId+".done") }; foreach (string path in filesToDelete) { try { File.Delete(path); } catch (Exception ex) { Log.Error(string.Format("delete file {0} failed due to {1}", path, ex.Message)); } } string[] foldersToDelete ={ Path.Combine(this.myAppPath,"logs",jobId) }; foreach (string path in foldersToDelete) { try { Directory.Delete(path); } catch (Exception ex) { Log.Error(string.Format("delete folder {0} failed due to {1}", path, ex.Message)); } } try { SyncRecord.DeleteSyncJobById(jobId, this.jobsDbPath); } catch (Exception ex) { Log.Error("delete sync job by id error, " + ex.Message); } this.SyncHistoryListBox.Items.Remove(selectedItem); this.syncRecordDict.Remove((ListBoxItem)selectedItem); } } else { Log.Error("load sync setting by id failed, " + jobId); } } }
private void przyciskDodajFilm_Click(object sender, RoutedEventArgs e) { bool czyPoprawny = true; string tytulFilmu = inputFilmTytul.Text; string dataFilmu = inputFilmRokProduckji.SelectedDate.Value.ToShortDateString(); string nagrodyFilmu = inputFilmNagrody.Text; string kategoriaFilmu = inputFilmKategoria.Text; string glownyAktorFilmu = inputFilmAktor.Text; string rezyserFilmu = inputFilmRezyser.Text; if (tytulFilmu == "" || dataFilmu == "" || nagrodyFilmu == "" || kategoriaFilmu == "" || glownyAktorFilmu == "" || rezyserFilmu == "") { czyPoprawny = false; MessageBox.Show("Nie wypełniono wszystkich wymaganych pól"); } string imieAktor = ""; string nazwiskoAktor = ""; string[] daneAktora = glownyAktorFilmu.Split(' '); if (daneAktora.Length == 2) { imieAktor = daneAktora[0]; nazwiskoAktor = daneAktora[1]; } else { MessageBox.Show("Nieprawidłowy aktor"); } string imieRezyser = ""; string nazwiskoRezyser = ""; string rodzajRezyser = ""; string[] daneRezysera = rezyserFilmu.Split(' '); if (daneRezysera.Length == 3) { imieRezyser = daneRezysera[0]; nazwiskoRezyser = daneRezysera[1]; rodzajRezyser = "Rezyser " + daneRezysera[2]; } if (czyPoprawny) { using (var ctx = new bazaEntities()) { bool czyJestPowiazanie = true; var kategoria = ctx.Category.SingleOrDefault(x => x.Name == kategoriaFilmu); var aktor = ctx.Actor.SingleOrDefault(x => x.FirstName == imieAktor && x.LastName == nazwiskoAktor); var rezyser = ctx.Director.SingleOrDefault(x => x.FirstName == imieRezyser && x.LastName == nazwiskoRezyser && x.DirectorType == rodzajRezyser); if (kategoria == null || aktor == null || rezyser == null) czyJestPowiazanie = false; if (czyJestPowiazanie) { ctx.Film.Add(new Film { Title = tytulFilmu, ProductionYear = Convert.ToDateTime(dataFilmu), Prizes = nagrodyFilmu, CategoryID = kategoria.ID, ActorID = aktor.ID, DirectorID = rezyser.ID, }); ctx.SaveChanges(); MessageBox.Show("Dodano nowy film do bazy"); } } } }
public static List<Product> GetProduct() //считывание файла products xml { Char separator = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0]; System.Globalization.NumberStyles style; System.Globalization.CultureInfo culture; style = System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.AllowCurrencySymbol; culture = System.Globalization.CultureInfo.CurrentUICulture; string pathFile = @"../../Xmls/products.xml"; if (!File.Exists(pathFile)) //если файл не найден { MessageBox.Show("File products not found"); return null; } else { try { List<Product> products = new List<Product>(); XmlDocument xDoc = new XmlDocument(); xDoc.Load(pathFile); XmlElement xRoot = xDoc.DocumentElement; foreach (XmlElement xnode in xRoot) { Product product = new Product(); product.Xml = xDoc; product.XmlIndex = xnode.GetHashCode(); foreach (XmlNode childnode in xnode.ChildNodes) { XmlNode type = xnode.Attributes.GetNamedItem("type"); if (type == null) return null; product.Type = type.Value; XmlNode name = xnode.Attributes.GetNamedItem("name"); if (name == null) return null; product.Name = name.Value; XmlNode fat = xnode.Attributes.GetNamedItem("fat"); if (fat == null) return null; product.Fat = fat.Value; if (childnode.Name == "NormalizedMixture") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { product.NormalizedMixture = result; } else { MessageBox.Show("Значение тега NormalizedMixture неверно ", "Ошибка"); product.NormalizedMixture = 0; } XmlNode mixName = childnode.Attributes.GetNamedItem("name"); if (mixName != null) product.MixtureName = mixName.Value; XmlNode mixFat = childnode.Attributes.GetNamedItem("fat"); if (mixFat != null) product.MixtureFat = mixFat.Value; } if (childnode.Name == "milk_base") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { product.MilkBaseValue = result; } else { MessageBox.Show("Значение тега milk_base неверно ", "Ошибка"); product.MilkBaseValue = 0; } XmlNode milkFat = childnode.Attributes.GetNamedItem("fat"); if (milkFat != null) product.MilkBaseFat = milkFat.Value; } if (childnode.Name == "milk_nofat") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { product.MilkNofatValue = result; } else { MessageBox.Show("Значение тега milk_nofat неверно ", "Ошибка"); product.MilkNofatValue = 0; } } if (childnode.Name == "Performance") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { product.Performance = result; } else { MessageBox.Show("Значение тега Performance неверно ", "Ошибка"); product.Performance = 0; } } if (childnode.Name == "Plotn") { if (Double.TryParse(childnode.InnerText.Replace('.', separator), style, culture, out double result)) { product.Plotn = result; } else { MessageBox.Show("Значение тега Plotn неверно ", "Ошибка"); product.Plotn = 0; } } if (childnode.Name == "image_name") { product.ImageName = childnode.InnerText; } else { product.ImageName = ("notfound"); } } products.Add(product); } return products; } catch(Exception exc) { MessageBox.Show("Ошибка чтения файла. \n " + exc.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } } }
/// <summary> /// 取得データの取り込み /// </summary> /// <param name="message"></param> public override void OnReceivedResponseData(CommunicationObject message) { try { this.ErrorMessage = string.Empty; base.SetFreeForInput(); var data = message.GetResultData(); DataTable tbl = (data is DataTable) ? (data as DataTable) : null; switch (message.GetMessageName()) { case GET_CNTL: this.WarimasiName1 = AppCommon.GetWarimasiName1(tbl); this.WarimasiName2 = AppCommon.GetWarimasiName2(tbl); break; case GET_RPT: GetReportFile(tbl); break; case SHR04010_KIKAN_SET: //this.請求書一覧データ = tbl; if (tbl == null) { this.sp請求データ一覧.ItemsSource = null; this.ErrorMessage = "システムエラーが発生しました。サポートにお問い合わせください。"; return; } else { 請求書一覧データ = (List <SHR04010_KIKAN>)AppCommon.ConvertFromDataTable(typeof(List <SHR04010_KIKAN>), tbl); //this.sp請求データ一覧.ItemsSource = this.請求書一覧データ.DefaultView; if (tbl.Rows.Count > 0) { } else { this.ErrorMessage = "指定された条件の請求データはありません。"; } } break; case SHR04010_SYUKEI: MessageBoxResult result = MessageBox.Show("集計が終了しました。\n\r終了しても宜しいでしょうか?" , "確認" , MessageBoxButton.YesNo , MessageBoxImage.Question); //OKならクリア if (result == MessageBoxResult.Yes) { this.Close(); } break; } } catch (Exception ex) { this.ErrorMessage = ex.Message; } }
/// <summary> /// F9 リボン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void OnF9Key(object sender, KeyEventArgs e) { //if (this.請求書一覧データ == null) //{ // this.ErrorMessage = "印刷データを取得していません。"; // return; //} //int cnt = 0; //foreach(DataRow rec in this.請求書一覧データ.Rows) //{ // if (rec.IsNull("印刷区分") != true && (bool)rec["印刷区分"] == true) // { // cnt++; // } //} //if (cnt == 0) //{ // this.ErrorMessage = "印刷対象が選択されていません。"; // return; //} //if (string.IsNullOrWhiteSpace(this.作成年月)) //{ // MessageBox.Show("入力エラーがあります。"); // return; //} //else //{ //} if (this.CheckAllValidation() != true) { MessageBox.Show("入力エラーがあります。"); return; } if (sp請求データ一覧.Rows.Count == 0) { this.ErrorMessage = "指定された条件の請求データはありません。"; MessageBox.Show("指定された条件の請求データはありません。"); return; } int? p作成年月; DateTime p作成年月日; DateTime Wk; p作成年月日 = DateTime.TryParse(this.作成年月, out Wk) ? Wk : DateTime.Today; p作成年月 = p作成年月日.Year * 100 + p作成年月日.Month; try { 請求書一覧TBL = new DataTable(); //リストをデータテーブルへ AppCommon.ConvertToDataTable(請求書一覧データ, 請求書一覧TBL); } catch (Exception) { return; }; try { base.SendRequest(new CommunicationObject(MessageType.RequestData, SHR04010_SYUKEI, this.請求書一覧TBL, p作成年月, p作成年月日)); base.SetBusyForInput(); } catch (Exception) { return; } }
private async void UploadDefaultFolder(int tryCount = 0) { if (!String.IsNullOrWhiteSpace(DefaultFolderTag)) { imgLoad.Visible = true; btnUploadDefaultFolder.Enabled = false; Controller controller = new Controller(); bool isUploaded; if (tryCount == 0) { isUploaded = await controller.UploadEmail(EmailItem, DefaultFolderTag, null); } else if (tryCount == 1) { isUploaded = await controller.UploadEmailDateTime(EmailItem, DefaultFolderTag, DateTime.Now); } else { imgLoad.Visible = false; btnUploadDefaultFolder.Enabled = true; return; } if (isUploaded) { Option.Read(); DirectorySettings dirSettings = Option.GetDirectorySettings(); LastUsedFolder = DefaultFolderName; LastUsedFolderTag = DefaultFolderTag; dirSettings.LastUsedFolder = LastUsedFolder; dirSettings.LastUsedFolderTag = LastUsedFolderTag; Option.SaveDirectorySettings(dirSettings); MessageBox.Show(UserInterfaceStrings.FilesUploadedSuccessfully); this.Close(); } else { //se vado in errore, riprovo aggiungendo al nome del file la data e l'ora if (tryCount == 0) { UploadDefaultFolder(++tryCount); //if (!string.IsNullOrEmpty(controller.Error))/*&& controller.Error.StartsWith("Duplicate child name not allowed")*/ //{ // UploadDefaultFolder(++tryCount); //} } else if (tryCount > 0) { if (string.IsNullOrEmpty(controller.Error)) MessageBox.Show(UserInterfaceStrings.ErrorOnUpload); else MessageBox.Show(controller.Error); } } imgLoad.Visible = false; btnUploadDefaultFolder.Enabled = true; } }
private void hELPToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("This is third lecture of ms c#"); }
private void UpdateRecord() { try { if (String.Compare(txtDescription.Text, "", false) == 0) { Common.setEmptyField("Transaction Description ", Program.ApplicationName); txtDescription.Focus(); return; } else if (radioGroup1.SelectedIndex == -1) { Common.setEmptyField("Transaction Type", Program.ApplicationName); return; } else if (string.IsNullOrEmpty(cboCatgory.Text)) { Common.setEmptyField("Element category", Program.ApplicationName); cboCatgory.Focus(); return; } else { //check form status either new or edit if (!boolIsUpdate) { using (SqlConnection db = new SqlConnection(Logic.ConnectionString)) { SqlTransaction transaction; db.Open(); transaction = db.BeginTransaction(); try { string query = String.Format("INSERT INTO Reconciliation.tblTransDefinition([Description],[Type],[ElementCatCode],IsActive) VALUES ('{0}','{1}','{2}','{3}');", txtDescription.Text.Trim(), radioGroup1.EditValue, cboCatgory.SelectedValue, 1); using (SqlCommand sqlCommand1 = new SqlCommand(query, db, transaction)) { sqlCommand1.ExecuteNonQuery(); } transaction.Commit(); } catch (SqlException sqlError) { transaction.Rollback(); } db.Close(); } setReload(); Common.setMessageBox("Record has been successfully added", Program.ApplicationName, 1); if (MessageBox.Show("Do you want to add another record?", Program.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { bttnCancel.PerformClick(); } else { //bttnReset.PerformClick(); setReload(); Clear(); } //} } else { //update the records using (SqlConnection db = new SqlConnection(Logic.ConnectionString)) { SqlTransaction transaction; db.Open(); transaction = db.BeginTransaction(); try { //MessageBox.Show(MDIMain.stateCode); //fieldid using (SqlCommand sqlCommand1 = new SqlCommand(String.Format(String.Format("UPDATE Reconciliation.tblTransDefinition SET [Description]='{{0}}',[Type]='{{1}}',[ElementCatCode]='{{2}}',IsActive='{{3}}' where TransID ='{0}'", ID), txtDescription.Text.Trim(), radioGroup1.EditValue, cboCatgory.SelectedValue, 1), db, transaction)) { sqlCommand1.ExecuteNonQuery(); } transaction.Commit(); } catch (SqlException sqlError) { transaction.Rollback(); } db.Close(); } setReload(); Common.setMessageBox("Changes in record has been successfully saved.", Program.ApplicationName, 1); //bttnReset.PerformClick(); tsbReload.PerformClick(); } } } catch (Exception ex) { Tripous.Sys.ErrorBox(ex); } }
private void ReloadSettings() { Option.Read(); LabelSettings labelSettings = Option.GetLabelSettings(); if (labelSettings != null) { if (labelSettings.Title != null) { LabelTitle = labelSettings.Title; } } ActionSettings actionSettings = Option.GetActionSettings(); if (actionSettings != null) { btnUploadSelectedFolder.Visible = !actionSettings.DisableStandardSave; btnUploadDefaultFolder.Visible = !actionSettings.DisableDefaultdSave; btnUploadLastFolder.Visible = !actionSettings.DisableLastSave; pnltxtDefaultFolder.Visible = !actionSettings.DisableDefaultdSave; pnltxtLastFolder.Visible = !actionSettings.DisableLastSave; } DirectorySettings dirSettings = Option.GetDirectorySettings(); if (dirSettings != null) { DefaultFolderTag = dirSettings.DefaultFolderTag; DefaultFolderName = dirSettings.DefaultFolder; if (!String.IsNullOrWhiteSpace(DefaultFolderTag)) { btnUploadDefaultFolder.Enabled = true; } else { btnUploadDefaultFolder.Enabled = false; } LastUsedFolder = dirSettings.LastUsedFolder; LastUsedFolderTag = dirSettings.LastUsedFolderTag; if (!String.IsNullOrWhiteSpace(LastUsedFolderTag)) { btnUploadLastFolder.Enabled = true; } else { btnUploadLastFolder.Enabled = false; } } ImageSettings imageSettings = Option.GetimageSettings(); if (imageSettings != null) { if (!String.IsNullOrWhiteSpace(imageSettings.HeadImage)) { pictureBoxHeadImage.ImageLocation = imageSettings.HeadImage; } else { pictureBoxHeadImage.Image = Properties.Resources.logoalfrescosmall; } try { if (!String.IsNullOrWhiteSpace(imageSettings.Icon)) { this.Icon = new Icon(imageSettings.Icon); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); //added } } }
//Cuadro de mensaje personalizado para utilizar en toda la aplicación public void mensagemInfoExibir(String titulo, String texto) { MessageBox.Show(titulo, texto, MessageBoxButtons.OK, MessageBoxIcon.Information); }
private async void FileSelector_LoadAsync(object sender, EventArgs e) { string Title = this.Text; string Password = ""; if(ManifestID==ContentDownloader.INVALID_MANIFEST_ID) ManifestID = ContentDownloader.GetSteam3DepotManifestStatic(DepotID, AppID, Branch,ref Password); if (ManifestID == ContentDownloader.INVALID_MANIFEST_ID) { MessageBox.Show(Properties.Resources.NoManifestID, "FileSelector", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } this.labelManifestID.Text = "ManifestID:" + ManifestID.ToString(); System.IO.Directory.CreateDirectory(Program.CacheDir); var localProtoManifest = DepotDownloader.ProtoManifest.LoadFromFile(string.Format("{0}/{1}.bin",Program.CacheDir, ManifestID)); if (localProtoManifest!=null) { depotManifest = localProtoManifest; } else { this.Text = "Downloading File List..."; this.Refresh(); ContentDownloader.Steam3.RequestDepotKey(DepotID,AppID); if(!ContentDownloader.Steam3.DepotKeys.ContainsKey(DepotID)) { MessageBox.Show(Properties.Resources.NoDepotKey, "FileSelector",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); //return; //User may still need to use FileRegex Close(); return; } byte[] depotKey = ContentDownloader.Steam3.DepotKeys[DepotID]; //ContentDownloader.Steam3.RequestAppTicket(AppID); ContentDownloader.Steam3.RequestAppTicket(DepotID); var client = await DepotDownloader.ContentDownloader.GlobalCDNPool.GetConnectionForDepotAsync(AppID, DepotID, depotKey, System.Threading.CancellationToken.None).ConfigureAwait(true); var SteamKitdepotManifest = await client.DownloadManifestAsync(DepotID, ManifestID).ConfigureAwait(true); if (SteamKitdepotManifest != null) { localProtoManifest = new ProtoManifest(SteamKitdepotManifest, ManifestID); localProtoManifest.SaveToFile(string.Format("{0}/{1}.bin", Program.CacheDir, ManifestID)); depotManifest = localProtoManifest; } } if(depotManifest!=null) { foreach (var file in localProtoManifest.Files) { //Process Dir var FilePathSplited = file.FileName.Split('\\'); List<string> FilePathList = new List<string>(FilePathSplited); TreeNode LastNode=null; TreeNodeCollection FileNodes = this.treeViewFileList.Nodes; while (FilePathList.Count != 0) { TreeNode TargetNode = null; foreach (TreeNode Tn in FileNodes) { if (Tn.Text == FilePathList[0]) { TargetNode = Tn; break; } } if (TargetNode == null) { LastNode = FileNodes.Add(FilePathList[0]); FileNodes = LastNode.Nodes; } else { FileNodes = TargetNode.Nodes; } FilePathList.RemoveAt(0); } if(file.Flags!=SteamKit2.EDepotFileFlag.Directory) { DepotMaxSize += file.TotalSize; //if(LastNode!=null) LastNode.Tag = file.TotalSize; } } float TargetSize = DepotMaxSize / 1024f; if(TargetSize<1024) { SizeDivisor = 1024f; UnitStr = "KB"; } else if(TargetSize/1024f<1024) { SizeDivisor = 1024 * 1024f; UnitStr = "MB"; } else { SizeDivisor = 1024 * 1024 * 1024f; UnitStr = "GB"; } this.labelSize.Text = string.Format("{0}{1}/{2}{1}", 0.ToString("#0.00"), UnitStr, (DepotMaxSize / SizeDivisor).ToString("#0.00")); } this.Text = Title; }
private void button1_Click(object sender, EventArgs e) { if (txtUsername.Text == "" || txtPassword.Text == "") { MessageBox.Show("Please Provide Textbox Fields"); } else { if (buttonuser.Text == "Confirm") { try { con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT* FROM usertbl WHERE username = '******' AND password = '******'"; dr = cmd.ExecuteReader(); if (dr.Read() == true) { MessageBox.Show("Login Successful"); ExamineeForm exam = new ExamineeForm(); exam.Show(); } else { MessageBox.Show("Username/password"); } } catch (Exception ex) { MessageBox.Show("Error Login User" + ex.ToString()); } finally { con.Close(); } } if (buttonuser.Text == "Login") { try { con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT * FROM admintbl WHERE username = '******' AND password = '******'"; dr = cmd.ExecuteReader(); if (dr.Read() == true) { MessageBox.Show("Succesful login Admin"); MainAdmin admin = new MainAdmin(); admin.Show(); } else { MessageBox.Show("Invalid Username/Password"); } } catch (Exception ex) { MessageBox.Show("Error Login Admin" + ex.Message); } finally { con.Close(); } } } }
public DialogResult Show(string text)//, string caption, int timeout) { //new AutoClosingMessageBox(text, caption, timeout); return MessageBox.Show(text, _caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); }
public static void SaveEquipments(Equipments eq) { if (eq == null) return; Char separator = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0]; DialogResult res = MessageBox.Show("Сохранить изменения?", "Программа ", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (res == DialogResult.Yes) { XmlElement xRoot = eq.Xml.DocumentElement; foreach (XmlElement xnode in xRoot) { if (xnode.GetHashCode() == eq.XmlIndex) { foreach (XmlNode childnode in xnode.ChildNodes) { if (childnode.Name == "type") { childnode.InnerText = eq.Type; } if (childnode.Name == "name") { childnode.InnerText = eq.Name; } if (childnode.Name == "ImageName") { childnode.InnerText = eq.ImageName; if (string.IsNullOrEmpty(eq.ImageName)) { eq.ImageName = "notfound"; } } if (childnode.Name == "Volume") { Double.Parse(childnode.InnerText = eq.Volume.ToString()); } if (childnode.Name == "Mass") { Double.Parse(childnode.InnerText = eq.Mass.ToString()); } if (childnode.Name == "Power") { Double.Parse(childnode.InnerText = eq.Power.ToString()); } if (childnode.Name == "Coeff") { Double.Parse(childnode.InnerText = eq.Coeff.ToString()); } if (childnode.Name == "W") { Double.Parse(childnode.InnerText = eq.W.ToString()); } if (childnode.Name == "Pressure") { childnode.InnerText = eq.Pressure; } if (childnode.Name == "Temperature") { childnode.InnerText = eq.Temperature; } if (childnode.Name == "Rotation") { childnode.InnerText = eq.Rotation; } if (childnode.Name == "Storage") { childnode.InnerText = eq.Storage; } if (childnode.Name == "Performance") { Double.Parse(childnode.InnerText = eq.Performance.ToString()); } } } } try { eq.Xml.Save(Helper.pathFile); eq.Xml.Save(@"../../Xmls/temp.xml"); //MessageBox.Show("Данные успешно сохранены.", "Сообщение."); } catch { MessageBox.Show("Невозможно сохранить XML файл.", "Ошибка."); } } if (res == DialogResult.No) { } }
//Muestra error en caso de imagen sin cargar private void campBuitImatge() { MessageBox.Show("Introdueixi una imatge", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
public static void SaveProduct(Product pr) { if (pr == null) return; Char separator = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0]; DialogResult res = MessageBox.Show("Сохранить изменения?", "Программа ", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (res == DialogResult.Yes) { XmlElement xRoot = pr.Xml.DocumentElement; foreach (XmlElement xnode in xRoot) { if (xnode.GetHashCode() == pr.XmlIndex) { XmlNode type = xnode.Attributes.GetNamedItem("type"); type.Value = pr.Type; XmlNode name = xnode.Attributes.GetNamedItem("name"); name.Value = pr.Name; XmlNode fat = xnode.Attributes.GetNamedItem("fat"); fat.Value = pr.Fat; foreach (XmlNode childnode in xnode.ChildNodes) { if (childnode.Name == "NormalizedMixture") { double.Parse(childnode.InnerText = pr.NormalizedMixture.ToString()); XmlNode mixName = childnode.Attributes.GetNamedItem("name"); if (mixName != null) mixName.Value = pr.MixtureName; XmlNode mixFat = childnode.Attributes.GetNamedItem("fat"); if (mixFat != null) mixFat.Value = pr.MixtureFat; } if (childnode.Name == "milk_base") { double.Parse(childnode.InnerText = pr.MilkBaseValue.ToString()); XmlNode milkFat = childnode.Attributes.GetNamedItem("fat"); if (milkFat != null) milkFat.Value = pr.MilkBaseFat; } if (childnode.Name == "milk_nofat") { double.Parse(childnode.InnerText = pr.MilkNofatValue.ToString()); } if (childnode.Name == "Plotn") { Double.Parse(childnode.InnerText = pr.Plotn.ToString()); } if (childnode.Name == "image_name") { pr.ImageName = childnode.InnerText; } else { pr.ImageName = ("notfound"); } } } } try { pr.Xml.Save(@"../../Xmls/products.xml"); //MessageBox.Show("Данные успешно сохранены.", "Сообщение."); } catch { MessageBox.Show("Невозможно сохранить XML файл.", "Ошибка."); } } if (res == DialogResult.No) { return; } }
}// END of Button_Click // This will check for a winner private void checkForWinner() { // this will remain false until we have a winner bool winner = false; // horizontal wins // A1 = A2 = A3 B1 = B2 = B3 C1 = C2 = C3 // A2 or B1 or C1 have to been disabled too if( ((A1.Text == A2.Text) && (A2.Text == A3.Text) && (!A1.Enabled)) ||((B1.Text == B2.Text)&&(B2.Text == B3.Text) && (!B1.Enabled)) ||((C1.Text == C2.Text) && (C2.Text == C3.Text) && (!C1.Enabled))) { winner = true; } // Vertical wins // A1 = B1 = C1 A2 = B2 = C2 A3 = B3 = C3 // A1 or A2 or A3 have to been disabled too if (((A1.Text == B1.Text) && (B1.Text == C1.Text) && (!A1.Enabled)) || ((A2.Text == B2.Text) && (B2.Text == C2.Text) && (!A2.Enabled)) || ((A3.Text == B3.Text) && (B3.Text == C3.Text) && (!A3.Enabled))) { winner = true; } // Diagonal wins // A1 = B2 = C3 A3 = B2 = C1 // A1 or A2 or A3 have to been disabled too if (((A1.Text == B2.Text) && (B2.Text == C3.Text) && (!A1.Enabled)) || ((A3.Text == B2.Text) && (B2.Text == C1.Text) && (!A3.Enabled))) { winner = true; } if (winner) { disableButtons(); String winnerStr = ""; // this will be executed after a player has made a turn, and the control is about // to be shifted to a following player. We will be checking for a winner. Which is // why you might look at this code and wonder why the turn would be true and the winner // be O, since turn = true = X and turn = false = O if(turn) { winnerStr = "PLayer 2 Wins!"; } else { winnerStr = "Player 1 Wins!"; } // this will display once a winner has been chosen MessageBox.Show(winnerStr, "The Results Are In..."); } else { // DRAW // if the turn count reaches 9, and there isn't a winner yet // the game must be labeled as a draw if(turn_count == 9) { MessageBox.Show("Bummer, it is a draw.", "The Results Are In..."); } } } // END of checkForWinner()
/// <summary> /// Name:pictureBox1_Click /// Description: a place for all the functionalities of the picture box /// </summary> /// <param name="sender">object sender</param> /// <param name="e">event arugment</param> private void pictureBox1_Click(object sender, EventArgs e) { MouseEventArgs clicks = e as MouseEventArgs; Point point = new Point(clicks.X, clicks.Y); Planets createdPlanet = new Planets(point); Bitmap bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics planet = Graphics.FromImage(bitmap); Graphics circle = Graphics.FromImage(bitmap); if (createButton.Checked) { COG gravity = new COG(); double dist = 100000.00; bool val = false; foreach (COG grav in this.cog) { var determinedDistance = Math.Sqrt(Math.Pow(point.X - grav.Location.X, 2) + Math.Pow(point.Y - grav.Location.Y, 2)); var distances = Math.Abs(determinedDistance); if (grav.Radius + 1 > distances) { val = true; if (!(dist < distances)) { dist = distances; gravity.Location = grav.Location; gravity.Radius = grav.Radius; } } } if (val != true) { MessageBox.Show("Place planet in a center of gravity zone"); } else { createdPlanet.evaluateCOG(gravity); this.planets.Add(createdPlanet); foreach (Planets plan in this.planets) { planet.FillEllipse(new SolidBrush(Color.Red), plan.PlanetLocation.X - 5, plan.PlanetLocation.Y - 5, 15, 15); foreach (COG center in this.cog) { planet.FillEllipse(new SolidBrush(Color.LightGray), center.Location.X - center.Radius, center.Location.Y - center.Radius, center.Radius * 2, center.Radius * 2); planet.FillEllipse(new SolidBrush(Color.Black), center.Location.X, center.Location.Y, 5, 5); } } pictureBox1.Image = bitmap; } } else if (CenterButton.Checked) { COG newGravity = new COG(point, (int)numericUpDown1.Value); this.cog.Add(newGravity); foreach (Planets pt in this.planets) { circle.FillEllipse(new SolidBrush(Color.Red), pt.PlanetLocation.X, pt.PlanetLocation.Y, 15, 15); foreach (COG center in this.cog) { circle.FillEllipse(new SolidBrush(Color.Black), center.Location.X - 3, center.Location.Y - 3, 5, 5); circle.FillEllipse(new SolidBrush(Color.LightGray), center.Location.X - center.Radius, center.Location.Y - center.Radius, center.Radius * 2, center.Radius * 2); } } pictureBox1.Image = bitmap; } else if (CenterButton.Checked == false && createButton.Checked == false) { MessageBox.Show("Select an option: create a center of gravity or create a planet."); } else { MessageBox.Show("Error!!!"); } }