public frmMain() { InitializeComponent(); listItemDelegate = new AddListItem(AddListItemMethod); AddTextDelegate = new AddText(AddtextMethod); resetButtonDelegate = new ResetButton(ResetButtonMethod); }
public RepertoryItem(Image img, AddText x) { mRepertoryImage = new Bitmap(img); at = new AddText(x); }
void UpdateFontSize() { var size = (float)AddText.GetFontSize(Element); _textView.SetTextSize(Android.Util.ComplexUnitType.Sp, size); }
static TestData() { //MainViewModel.MainViewModelStatic.ItemClasses.Add(Editor.ObjectTypes.ItemClass.GetBaseItemClass()); TestScript = new Script(); TestScript.ScriptLines.Clear(); TestScript.ScriptLines.Add(new Comment { CommentText = "test comment" }); TestScript.ScriptLines.Add(new Comment { CommentText = "another test comment" }); TestCondition1 = new Conditional(TestScript); TestCondition1.ThenStatement.AddBeforeSelected(new Comment { CommentText = "Test Conditional Comment" }); TestCondition1.ElseStatement.AddBeforeSelected(new Comment { CommentText = "Test Else Comment" }); TestConditionNested = new Conditional(TestScript); TestConditionChild = new Conditional(TestScript); TestConditionChild.ThenStatement.AddBeforeSelected(new Comment { CommentText = "Another comment" }); TestConditionChild.ElseStatement.AddBeforeSelected(new Comment { CommentText = "Another else comment" }); TestConditionNested.ThenStatement.AddBeforeSelected(TestConditionChild); TestConditionChild = new Conditional(TestScript); TestScript.ScriptLines.Add(TestCondition1); TestScript.ScriptLines.Add(TestConditionNested); TestScript.ScriptLines.Add(new Blank()); TestComment = new Comment { CommentText = "This is my comment." }; TestDisplayText = new DisplayText { Text = "The room is dark and reeks of old milk.\n\nThere is an unlit chandalier." }; TestAddText = new AddText { Text = "A fresh, crisp, tasty looking apple." }; TestRoom = new Room(); TestRoom.RoomName = "Test Room"; TestRoom.Description = "Test Room Description"; TestRoom.HasPlaintextDescription = false; TestRoom.RoomID = new Guid("{1CF2C7E6-276C-4678-951C-2D1B1F239620}"); TestRoom.RoomDescriptionScript = TestScript; TestScriptRoom = new Room(); TestScriptRoom.RoomName = "Test Room"; TestScriptRoom.Description = "Test Room Description"; TestScriptRoom.HasPlaintextDescription = true; TestScriptRoom.RoomID = new Guid("{1CF2C7E6-276C-4678-951C-2D1B1F239620}"); TestScriptRoom.RoomDescriptionScript = TestScript; TestInteractable = new Interactable(); TestInteractable.InteractableName = "Bookshelf"; TestInteractable.DefaultDisplayName = "Old Bookshelf"; TestInteractable.CanExamine = true; TestInteractable.CanExamineUsesScript = true; TestInteractable.CanInteract = true; TestInteractable.CanInteractUsesScript = false; Script testIntCanExScript = new Script(); testIntCanExScript.AddBeforeSelected(new Comment { CommentText = "Test Can Examine Script" }); Script testIntCanInScript = new Script(); testIntCanInScript.AddBeforeSelected(new Comment { CommentText = "Test Can Interact Script" }); Script testIntExScript = new Script(); testIntExScript.AddBeforeSelected(new Comment { CommentText = "Test Examine Script" }); Script testIntInScript = new Script(); testIntInScript.AddBeforeSelected(new Comment { CommentText = "Test Interaction Script" }); TestInteractable.ExamineScript = testIntExScript; TestInteractable.InteractScript = testIntInScript; TestInteractable.CanInteractScript = testIntCanInScript; TestInteractable.CanExamineScript = testIntCanExScript; TestInteractable.GroupName = "Furniture"; TestInteractableGroup = MainViewModel.MainViewModelStatic.InteractableGroups.FirstOrDefault(); TestRoom.DefaultInteractables.Add(new InteractableRef(TestInteractable.InteractableID)); TestDateTimeVariable = new Variable(); TestDateTimeVariable.IsDateTime = true; TestDateTimeVariable.DefaultDateTime = new DateTime(2015, 1, 30, 10, 20, 5); TestDateTimeVariable.Name = "Test Date Time"; TestStringVariable = new Variable(); TestStringVariable.IsString = true; TestStringVariable.DefaultString = "Test Data"; TestStringVariable.Name = "Test String"; TestNumberVariable = new Variable(); TestNumberVariable.IsNumber = true; TestNumberVariable.DefaultNumber = 5; TestNumberVariable.Name = "Test Number"; TestSetVariable = new SetVariable(); TestSetVariable.SelectedVariable = new VarRef(TestNumberVariable.Id); //var testParent = new ItemClass() { Name = "Item" }; //MainViewModel.MainViewModelStatic.ItemClasses.Add(TestItemClass); TestItemClass = new ItemClass { Name = "Clothing", ParentClass = ItemClass.GetBaseItemClass() }; TestItemClass.ItemProperties.Add(new Variable { Name = "Slot", IsString = true, DefaultString = "Body" }); TestItemClass.ItemProperties.Add(new Variable { Name = "Weight", IsNumber = true, DefaultNumber = 40 }); //MainViewModel.MainViewModelStatic.ItemClasses.Add(TestItemClass); var testChild1 = new ItemClass() { Name = "Shirts", ParentClass = TestItemClass }; var testChild2 = new ItemClass() { Name = "Pants", ParentClass = TestItemClass }; var testChild3 = new ItemClass() { Name = "Underwear", ParentClass = TestItemClass }; var testChild4 = new ItemClass() { Name = "Food", ParentClass = TestItemClass }; testChild4.ParentClass = TestItemClass.ParentClass; var testItem = new Item() { ItemClassParent = TestItemClass, DefaultName = "Helmet" }; var testItem2 = new Item() { ItemClassParent = TestItemClass, DefaultName = "Bracers" }; var testItem3 = new Item() { ItemClassParent = TestItemClass, DefaultName = "Apple" }; testItem3.ItemClassParent = TestItemClass.ParentClass; TestItemClass.SelectedProperty = TestItemClass.ItemProperties.First(); testItem2.ItemName = "BasicBracers"; testItem2.IsEquipment = true; testItem2.SelectedProperty = testItem.ItemProperties.First(); TestItem = testItem2; TestAddItem = new AddItemToInventory { ItemReference = new ItemRef(testItem.ItemID) }; TestGetProperty = new GetItemProperty { VarRef = new VarRef(TestStringVariable.Id), SelectedItemClass = TestItemClass }; TestGetProperty.SelectedProperty = TestGetProperty.SelectedItemClass.ItemProperties.First(); TestSetProperty = new SetItemProperty { VarRef = new VarRef(TestStringVariable.Id), SelectedItemClass = TestItemClass }; TestSetProperty.SelectedProperty = TestSetProperty.SelectedItemClass.ItemProperties.First(); Settings1 = new PlayerSettings(); Settings1.PlayerDescription.AddBeforeSelected(new AddText { Text = "You are a {{Age}} year old {{Gender}}" }); PlayerStatistic testHunger = new PlayerStatistic { Label = "Hunger" }; testHunger.DisplayCondition.AddBeforeSelected(new ReturnFalse()); testHunger.AssociatedVariable = new VarRef(TestNumberVariable.Id); testHunger.IsProgressBar = true; testHunger.HighWarning = false; testHunger.LowWarning = true; testHunger.MaximumValueVariable = true; testHunger.MaximumValueVariableValue = new VarRef(TestNumberVariable.Id); PlayerStatistic testSpecies = new PlayerStatistic { Label = "Species" }; testSpecies.Label = "Species"; testSpecies.AssociatedVariable = new VarRef(TestNumberVariable.Id); testSpecies.IsPlaintext = true; Settings1.PlayerStatistics.Add(testHunger); Settings1.PlayerStatistics.Add(testSpecies); Settings1.SelectedStatistic = testHunger; Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Body" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Legs" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Wrists" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Feet" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Head" }); Settings1.SelectedEquipmentSlot = Settings1.EquipmentSlots.First(); testItem2.EquipmentRef.OccupiesSlots.Add(Settings1.SelectedEquipmentSlot); TestCommonEvent = new CommonEvent(); //TestCommonEvent.Name = "Test"; //TestCommonEvent.EventType = CommonEvent.CommonEventTypes.First(); TestConversation = new Conversation(); TestConversation.Name = "Test"; TestConversation.StartingStage = 10; ConversationStage TestStage1 = new ConversationStage(); TestStage1.StageName = "Test Intro Point"; TestStage1.StageAction.AddBeforeSelected(new DisplayText { Text = "Test Stuff" }); TestStage1.StageId = 10; TestStage1.Choices.Add(new ConversationChoice() { ChoiceText = "Choice 1", Target = 20 }); TestStage1.Choices.Add(new ConversationChoice() { ChoiceText = "Choice 2", Target = 30 }); ConversationStage TestStage2 = new ConversationStage(); TestStage2.StageName = "Stage #2"; ConversationStage TestStage3 = new ConversationStage(); TestStage3.StageName = "Stage #3"; TestStage2.StageId = 20; TestStage3.StageId = 30; TestConversation.Stages.Add(TestStage1); TestConversation.Stages.Add(TestStage2); TestConversation.SelectedStage = TestStage1; TestConversation.Stages.Add(TestStage3); TestStage1.SelectedChoice = TestStage1.Choices.First(); TestStage1.SelectedChoice.ChoiceVisibility.AddBeforeSelected(new ReturnTrue()); //var tempRooms = new System.Collections.ObjectModel.ObservableCollection<Room>(); //tempRooms.Add(TestData.TestRoom); //MainViewModel.MainViewModelStatic.Zones.Add(new Zone { ZoneName = "Test", Rooms = tempRooms }); //TestArray.IsNumber = true; //TestArray.Name = "Test"; //TestArray.Group = "Test Group"; TestStatusEffect = new StatusEffect(); TestStatusEffect.Name = "Sample Status Effect"; TestStatusEffect.OnInitialize.AddBeforeSelected(new Comment { CommentText = "On Initialize Script" }); TestStatusEffect.OnMove.AddBeforeSelected(new Comment { CommentText = "On Move Script" }); TestStatusEffect.OnStack.AddBeforeSelected(new Comment { CommentText = "On Stack Script" }); TestStatusEffect.OnFinish.AddBeforeSelected(new Comment { CommentText = "On Finish Script" }); TestStatusEffect.CheckIfCleared.AddBeforeSelected(new Comment { CommentText = "Check If Cleared Script" }); TestStatusEffect.CanOccurMultipleTimes = false; TestStatusEffect.Arguments.Add(new StatusEffectValue { Name = "Duration", IsNumber = true }); TestStatusEffect.Arguments.Add(new StatusEffectValue { Name = "Text Test", IsString = true }); TestStatusEffect.SelectedArgument = TestStatusEffect.Arguments.Last(); //AddStatusEffectTest = new AddStatusEffect(); //AddStatusEffectTest.AssociatedEffect = new GenericRef<StatusEffect>((id) => TestStatusEffect, (statusEffect) => TestStatusEffect.Id) { Ref = TestStatusEffect.Id }; //AddStatusEffect.UpdateAllArguments(TestStatusEffect); }
void UpdateTextColor() { _textLabel.TextColor = AddText.GetTextColor(Element).ToUIColor(); }
void UpdateFontSize() { _textLabel.Font = _textLabel.Font.WithSize((float)AddText.GetFontSize(Element)); }
void UpdatePadding() { var padding = AddText.GetPadding(Element); _textLabel.Padding = new UIEdgeInsets((float)padding.Top, (float)padding.Left, (float)padding.Bottom, (float)padding.Right); }
void UpdateBackgroundColor() { _textLabel.BackgroundColor = AddText.GetBackgroundColor(Element).ToUIColor(); }
private void dl_config() { AddText method = new AddText(this.add_text); AddListItem item = new AddListItem(this.add_list_item); base.Invoke(method, new object[] { "检测是否有新版本..." }); base.Invoke(method, new object[] { "读取远程配置文件..." }); ini_config _config = new ini_config("config.ini"); try { bool flag = false; Thread thread = new Thread(new ThreadStart(this.GetAddress)) { IsBackground = true }; thread.Start(); thread.Join(); if (!string.IsNullOrEmpty(this.text)) { if (this.text.IndexOf("#END#") == -1) { throw new Exception(); } string[] strArray = this.text.Split(Environment.NewLine.ToCharArray()); string str = string.Empty; string str2 = _config.read_ini("VeryPdf", "App"); string str3 = string.Empty; string str4 = ""; for (int i = 0; i < (strArray.Length - 1); i++) { if (strArray[i] != string.Empty) { if (strArray[i].Contains("#END#")) { break; } if (strArray[i].Contains("version")) { str = strArray[i].Split(new char[] { ',' })[1]; } else if (strArray[i].Contains("veryPdf")) { str3 = strArray[i].Split(new char[] { ',' })[1]; } else { string[] strArray2 = strArray[i].Split(new char[] { ',' }); if (!(PDF_Convert.Version.dic_ver.TryGetValue(strArray2[0], out str4) && (System.Convert.ToInt32(PDF_Convert.Version.dic_ver[strArray2[0]].Replace(".", "")) >= System.Convert.ToInt32(strArray2[1].Replace(".", ""))))) { this.dl_lst.Add(new detail_list(strArray2[2], System.Convert.ToInt32(strArray2[3]))); base.Invoke(item); flag = true; } } } } if (!string.IsNullOrEmpty(str3)) { try { if (string.IsNullOrEmpty(str2) || (System.Convert.ToDouble(str2) < System.Convert.ToDouble(str3))) { this.dl_lst.Add(new detail_list("VeryPdf.rar", 0x4f832a)); base.Invoke(item); flag = true; } } catch { } } if (flag) { base.Invoke(new _Show(this.show_this_window)); base.Invoke(method, new object[] { "开始下载新文件..." }); Thread thread2 = new Thread(new ThreadStart(this.dl_file)) { IsBackground = true }; thread2.Start(); thread2.Join(); ProcessStartInfo startInfo = new ProcessStartInfo(Application.StartupPath + @"\PDF Update.exe") { Arguments = "Madoka " + Process.GetCurrentProcess().Id.ToString() }; foreach (detail_list _list in this.dl_lst) { startInfo.Arguments = startInfo.Arguments + string.Format(" \"{0}\"", _list.file_name); } Process.Start(startInfo); base.Invoke(method, new object[] { "下载新文件成功,程序即将退出以便进行更新" }); Thread.Sleep(0x3e8); _config.write_ini("Version", str, "App"); _config.write_ini("VeryPdf", str3, "App"); } base.Invoke(new _Exit(this.Close)); } } catch { base.Invoke(new _Exit(this.Close)); } }
void UpdateTextColor() { _textView.SetTextColor(AddText.GetTextColor(Element).ToAndroid()); }
void UpdateBackgroundColor() { _textView.SetBackgroundColor(AddText.GetBackgroundColor(Element).ToAndroid()); }
//хитрая добавлялка на основе делегата т.к. в др потоке не доступны все наши лейблы и др элементы private void AddTextLabel4(string text) { try { if (this.label4.InvokeRequired) //если этот метод AddTextLabel2 вызван из ДРУГОГО ПОТОКА (т.е. если мы хотим обратиться к лейбл2 из др потока) { AddText d = new AddText(AddTextLabel4); //заводим делегата(т.е. переменную делегатного типа AddText),который будет вызывать этуже функцию AddTextLabel2 this.Invoke(d, new object[] { text }); //invoke выполняет указанный делегат(d) в том потоке которому принадлежит список оргументов т.е. т.к. object принадлежит основному потоку то делегат будет выполнен в этом потоке,и делегат вызовет опять этуже функцию AddTextLabel2 } else //т.к. выше делегат вызывает эту же функцию но уже в основном потоке (с помощью Invoke) { //то просто выводим текст на лэйбл 2 т.к. мы уже в основном потоке this.label4.Text = text; } } catch (Exception Ex) { } }
/// <summary> /// Выводит в поле вывода заданную строку. /// </summary> /// <param name="data">Строка данных для вывода.</param> /// <param name="type">Тип выводимого сообщения.</param> /// <param name="ns">Добавить символ новой строки.</param> private void WriteString(string data, MessageType type, bool ns) { if (txtCommandBox.InvokeRequired) { AddText d = new AddText(WriteString); txtCommandBox.BeginInvoke(d, new object[] { data, type, ns }); } else { switch (type) { case MessageType.Success: txtCommandBox.SelectionColor = Color.Green; if (ns) txtCommandBox.AppendText(data + "\n"); else txtCommandBox.AppendText(data); break; case MessageType.Error: txtCommandBox.SelectionColor = Color.Red; if (ns) txtCommandBox.AppendText(data + "\n"); else txtCommandBox.AppendText(data); break; case MessageType.Normal: txtCommandBox.SelectionColor = Color.Black; txtCommandBox.AppendText(data); break; } txtCommandBox.SelectionColor = Color.Black; } }
public AddTextWrapper(AddText at) { line = at; }
public UdpMessageTest() { addTextDelegate = new AddText(addText); InitializeComponent(); }
public IHttpActionResult AddTextToFooter([FromUri] Guid footer_id, [FromBody] AddText text) { if (IsTokenValid() && authenticationService.IsAllowedToUpdateFooters(GetTokenUserEmail(), footer_id)) { try { Text newText = textManagementService.AddToFooter(footer_id, AddText.ToEntity(text)); BaseText modelNewText = BaseText.ToModel(newText); documentLogger.LogModificationToFooter(footer_id); return(CreatedAtRoute("AddTextToFooter", new { footerid = footer_id, textid = modelNewText.Id }, modelNewText)); } catch (MissingFooterException e) { return(BadRequest(e.Message)); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }