protected Gtk.Widget GladeCustomWidgetHandler(Glade.XML xml, string func_name, string name, string string1, string string2, int int1, int int2) { if (func_name == "TileList") { ToolTilesProps = CreateTileList(); return(ToolTilesProps); } if (func_name == "ObjectList") { ToolObjectsProps = CreateObjectList(); return(ToolObjectsProps); } if (func_name == "GObjectList") { ToolGObjectsProps = new GameObjectListWidget(this); return(ToolGObjectsProps); } if (func_name == "SectorSwitchNotebook") { sectorSwitchNotebook = new SectorSwitchNotebook(this); sectorSwitchNotebook.ShowAll(); return(sectorSwitchNotebook); } if (func_name == "LayerList") { layerList = new LayerListWidget(this); return(layerList); } if (func_name == "PropertiesView") { propertiesView = new PropertiesView(this); return(propertiesView); } throw new Exception("No Custom Widget Handler named \"" + func_name + "\" exists"); }
private void SelectObjectProperty(object sender, ObjectProperty valueProperty) { var propertiesForm = new PropertiesForm(); propertiesForm.ParentProperty = PropertiesView.FocusedColumn.FieldName; propertiesForm.SetPropertyEditors(_repository.Editors); propertiesForm.SetSimpleProperties(valueProperty.SimpleProperties); propertiesForm.SetCollectionProperties(valueProperty.CollectionProperties); propertiesForm.SetValidationRules(valueProperty.ValidationRules); if (propertiesForm.ShowDialog() == DialogResult.OK) { //долбаный грид заворачивает объект в строку при создании DataRow dynamic instance = PropertiesView.GetFocusedValue().ToString().ToDynamic(); DesignerExtensions.SetSimplePropertiesToInstance(valueProperty.SimpleProperties, instance); DesignerExtensions.SetCollectionPropertiesToInstance(valueProperty.CollectionProperties, instance); ((ButtonEdit)sender).EditValue = instance.ToString(); ((ButtonEdit)sender).Refresh(); } else { propertiesForm.RevertChanges(); } }
/// <summary> /// Create a property dialog for an existing source /// </summary> /// <param name="source">Source of type ObsSource</param> public TestProperties(ObsSource source) : this() { this.source = source; ObsData sourceSettings = source.GetSettings(); view = new PropertiesView(sourceSettings, source, source.GetProperties, source.GetDefaults, source.Update); propertyPanel.Controls.Add(view); undoButton.Click += (sender, args) => { view.ResetChanges(); }; defaultButton.Click += (sender, args) => { view.ResetToDefaults(); }; okButton.Click += (o, args) => { view.UpdateSettings(); DialogResult = DialogResult.OK; Close(); }; cancelButton.Click += (o, args) => { view.ResetChanges(); DialogResult = DialogResult.Cancel; Close(); }; }
public override Widget Create(object caller) { HBox box = new HBox(); PropertiesView propview = (PropertiesView)caller; // Add the names of the sectors to a list sectorNames = new List <String>(propview.application.CurrentLevel.Sectors.Count); foreach (Sector sector in propview.application.CurrentLevel.Sectors) { sectorNames.Add(sector.Name); } // Populate a combo box with the sector names comboBox = new ComboBox(sectorNames.ToArray()); OnFieldChanged(Field); //same code for initialization comboBox.Changed += OnComboBoxChanged; box.PackStart(comboBox, true, true, 0); box.Name = Field.Name; CreateToolTip(caller, comboBox); return(box); }
// Set the project and subscribe to its events. public void SetProject(Project p) { MainProject = p; MainProject.AreaListChanged += LoadAreaListBox; MainProject.RoomListChanged += LoadRoomListBox; MainProject.RoomStateListChanged += LoadRoomStateListBox; MainProject.AreaSelected += AreaSelected; MainProject.RoomSelected += RoomSelected; MainProject.RoomStateSelected += RoomStateSelected; MainProject.DoorSelected += LoadDoorData; MainProject.LevelDataSelected += NewLevelData; MainProject.LevelDataModified += LevelDataModified; MainProject.PlmSelected += PlmEnemySelected; MainProject.PlmModified += PlmEnemySelected; MainProject.EnemySelected += PlmEnemySelected; MainProject.EnemyModified += PlmEnemySelected; NavigateView.ScreenSelected += LevelDataScrollToScreen; EnemyLayerEditor.AddEnemy += AddEnemy; PlmLayerEditor.AddPlm += AddPlm; NavigateView.SetProject(MainProject); PropertiesView.SetProject(MainProject); TileLayersEditor.SetProject(MainProject); PlmLayerEditor.SetProject(MainProject); EnemyLayerEditor.SetProject(MainProject); ScrollLayerEditor.SetProject(MainProject); FxLayerEditor.SetProject(MainProject); }
private void PopulateControls(Filter filter) { if (propertyPanel.Controls.Contains(view)) { propertyPanel.Controls.Remove(view); } view = new PropertiesView(filter.GetSettings(), filter, filter.GetProperties, filter.GetDefaults, filter.Update); propertyPanel.Controls.Add(view); }
public MainWindowViewModel(EntityDirectory directory) { EntityDirectory = directory; Initialise(directory); GeneralView = new GeneralView(this); ActionsLocationView = new ActionsLocationView(this); ArraysView = new ArraysView(this); CollidersView = new CollidersView(this); EmoticonsView = new EmoticonsView(this); PropertiesView = new PropertiesView(this); }
/// <summary> Static member accesible for other ICustomSettingsWidgets. </summary> public static void CreateToolTip(object caller, Widget widget, FieldOrProperty field) { // Create a tooltip if we can. PropertyPropertiesAttribute propertyProperties = (PropertyPropertiesAttribute) field.GetCustomAttribute(typeof(PropertyPropertiesAttribute)); if ((propertyProperties != null) && (caller.GetType() == typeof(PropertiesView))) { PropertiesView propview = (PropertiesView)caller; propview.tooltips.SetTip(widget, propertyProperties.Tooltip, propertyProperties.Tooltip); } }
public IActionResult AddFeatures(PropertiesView model) { if (ModelState.IsValid) { var rs = _product.Save(model); if (rs.Id > 0) { model.Description = string.Empty; return(View("_properties", model)); } } return(View("_properties", model)); }
public IActionResult AddFeatures(int id) { if (id < 1) { return(RedirectToAction("Index")); } var product = _product.Get(s => s.Id == id).SingleOrDefault(); var features = new PropertiesView(); features.ProductId = id; features.ProductName = $"{ product.Name.ToUpper()} || {product.ProductCategory.Name.ToUpper()}"; return(View("_properties", features)); }
private void explorerTreeView_NodeMouseDoubleClick(object sender, RadTreeViewEventArgs e) { var p = e.Node.Tag as PropertiesView; var f = e.Node.Tag as Core.ProjectSystem.File; if (p != null) { var v = new PropertiesView(); var doc = new DocumentWindow(e.Node.Text); doc.Controls.Add(v.GetView()); AddDocument(doc); } if (f != null) { ItemTemplate np = null; Plugin nn = null; foreach (var item in Workspace.PluginManager.Plugins) { foreach (var it in item.ItemTemplates) { if (it.ID == f.ID) { np = it; nn = item; } } } byte[] raw = null; if (Workspace.SelectedProject != null) { raw = System.IO.File.ReadAllBytes(new FileInfo(Workspace.SolutionPath).Directory.FullName + "\\" + f.Src); } else { raw = System.IO.File.ReadAllBytes(f.Src); } nn?.Events.Fire("OnCreateItem", np, f, raw); var doc = new DocumentWindow(f.Name); doc.Controls.Add(ViewSelector.Select(np, raw, f, np?.AutoCompletionProvider as IntellisenseProvider, doc).GetView()); AddDocument(doc); } }
public void Load() { PropertiesView.Clear(); //model code bude npr system.controls.combobox.nesto: protswitch, pa zato moramo da parsiramo try { var parsedString = ModelCode.Split(':'); ModelCode = parsedString[1]; } catch (Exception) { MessageBox.Show("Choose valid Model Code from list first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } mc = 0; try { if (!ModelCodeHelper.GetModelCodeFromString(ModelCode, out mc)) { if (ModelCode.StartsWith("0x", StringComparison.Ordinal)) { mc = (ModelCode)long.Parse(ModelCode.Substring(2), System.Globalization.NumberStyles.HexNumber); } else { mc = (ModelCode)long.Parse(ModelCode); } } } catch (Exception) { MessageBox.Show("Chosen Model Code is not valid", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); getExtendedValuesView.tbModelCode.Focus(); return; } List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds(mc); foreach (var item in properties) { PropertiesView.Add(new PopertyView(item.ToString(), true)); } }
private void Load() { PropertiesView.Clear(); if (string.IsNullOrEmpty(Gid)) { MessageBox.Show("You first have to enter GID", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { if (Gid.StartsWith("0x", StringComparison.Ordinal)) { var NewGid = Gid.Remove(0, 2); g = Convert.ToInt64(Int64.Parse(NewGid, System.Globalization.NumberStyles.HexNumber)); } else { g = Convert.ToInt64(Gid); } } catch (Exception) { MessageBox.Show("You entered invalid GID", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { short type = ModelCodeHelper.ExtractTypeFromGlobalId(g); List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds((DMSType)type); foreach (var v in properties) { PropertiesView.Add(new PopertyView(v.ToString(), true)); //popuni sa svim propertijima i da su svi cekirani } } catch (Exception) { // ignored } }
public PropertiesViewModel(IPropertiesToolboxToolbarService toolbarService, IEventAggregator aggregator, ICommandManager commandManager) : base(toolbarService) { IsValidationEnabled = false; _propertiesToolboxToolbar = toolbarService; _aggregator = aggregator; _commandManager = commandManager; Name = "Properties"; Title = "Properties"; ContentId = "Properties";//TODO : Move to constants IsVisible = false; _view = new PropertiesView(this); View = _view; }
public void InitView(BaseTool tool) { if (tool == null) { _currentView = _propertiesViews[0]; _propertiesViews[0].Show(null); return; } foreach (var view in _propertiesViews) { if (view.GetType() == tool.ViewType) { _currentView = view; view.Show(tool); continue; } else { view.gameObject.SetActive(false); } } }
public void SetWindows(OgreControl renderViewControl, TreeView treeControl, PropertiesView propsControl) { this.renderViewControl = renderViewControl; this.treeControl = treeControl; this.propsControl = propsControl; }
protected Widget GladeCustomWidgetHandler(Glade.XML xml, string func_name, string name, string string1, string string2, int int1, int int2) { if(func_name == "TileList") { ToolTilesProps = CreateTileList(); return ToolTilesProps; } if(func_name == "ObjectList") { ToolObjectsProps = new ObjectListWidget(this); return ToolObjectsProps; } if(func_name == "GObjectList") { Widget ToolGObjectsProps = new GameObjectListWidget(this); return ToolGObjectsProps; } if(func_name == "SectorSwitchNotebook") { sectorSwitchNotebook = new SectorSwitchNotebook(this); sectorSwitchNotebook.SectorChanged += ChangeCurrentSector; sectorSwitchNotebook.ShowAll(); return sectorSwitchNotebook; } if(func_name == "LayerList") { layerList = new LayerListWidget(this); return layerList; } if(func_name == "PropertiesView") { propertiesView = new PropertiesView(this); return propertiesView; } throw new Exception("No Custom Widget Handler named \""+func_name+"\" exists"); }
protected dynamic GetItemProperty(string propertyName) { return(PropertiesView .GetFocusedDataRow().Field <object>(propertyName)); }
public ActionResult Format(int id) { //lấy record file trong database bằng id truyền vào var file = db.FileTable.Find(id); if (file == null) { return(HttpNotFound()); } //lấy format của trang lúc upload chọn var pageFilter = db.PageFormat.Find(file.PageId); if (pageFilter == null) { return(HttpNotFound()); } //lay format của loại trang var filter = (from ppf in db.PagePropertiesFormat where ppf.PageId == pageFilter.Id orderby ppf.Row ascending select ppf).ToList(); if (filter == null) { return(HttpNotFound()); } //đọc file vào bộ nhớ ram byte[] temp = null; using (var fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath(file.Path + "/" + file.Name), FileMode.Open, FileAccess.Read)) { temp = new byte[fs.Length]; fs.Read(temp, 0, (int)fs.Length); } MemoryStream ms = new MemoryStream(); ms.Write(temp, 0, temp.Length); //Docx.dll (Novacode) load file từ bộ nhớ ram var docx = DocX.Load(ms); //khởi tạo 1 list đoạn văn thường mỗi dòng là một đoạn văn trừ một số trường hợp hy hữu var paragraphs = new List <ParagraphInfo>(); int index = 1; //tìm kiếm các đoạn văn trong file docx vừa load, xong thêm vào list các đoạn văn ở trên foreach (var p in docx.Paragraphs) { var info = new ParagraphInfo { Paragraph = p, Row = index }; //kiểm tra đoạn văn không phải khoảng trắng, xuống dòng trống thì thêm vào list if (!p.Text.Trim().Equals("")) { paragraphs.Add(info); index++; //var f = p.MagicText[0].formatting; //string font_family = f.FontFamily.Name; //int size = (int)f.Size.Value; //System.Drawing.Font font = new System.Drawing.Font(font_family, size); //var l = LineSpacing(font, p.Text); } } //khởi tạo từ điển để chứa các lỗi var fv = new FormatView(); fv.Page.isOk = true; if (pageFilter.isCentimeter) { fv.Page.MarginTop.FileValue = docx.MarginTop.ToString(); fv.Page.MarginTop.DBValue = pageFilter.MarginTop.ToString(); if (!(convert.PaperClipsToCentimeters(pageFilter.MarginTop) == convert.PaperClipsToCentimeters(docx.MarginTop))) { fv.Page.isOk = false; fv.Page.MarginTop.isError = true; } fv.Page.MarginBottom.FileValue = docx.MarginBottom.ToString(); fv.Page.MarginBottom.DBValue = pageFilter.MarginBottom.ToString(); if (!(convert.PaperClipsToCentimeters(pageFilter.MarginBottom) == convert.PaperClipsToCentimeters(docx.MarginBottom))) { fv.Page.isOk = false; fv.Page.MarginBottom.isError = true; } fv.Page.MarginLeft.FileValue = docx.MarginLeft.ToString(); fv.Page.MarginLeft.DBValue = pageFilter.MarginLeft.ToString(); if (!(convert.PaperClipsToCentimeters(pageFilter.MarginLeft) == convert.PaperClipsToCentimeters(docx.MarginLeft))) { fv.Page.isOk = false; fv.Page.MarginLeft.isError = true; } fv.Page.MarginRight.FileValue = docx.MarginRight.ToString(); fv.Page.MarginRight.DBValue = pageFilter.MarginRight.ToString(); if (!(convert.PaperClipsToCentimeters(pageFilter.MarginRight) == convert.PaperClipsToCentimeters(docx.MarginRight))) { fv.Page.isOk = false; fv.Page.MarginRight.isError = true; } } else { fv.Page.MarginTop.FileValue = docx.MarginTop.ToString(); fv.Page.MarginTop.DBValue = pageFilter.MarginTop.ToString(); if (!(pageFilter.MarginTop == docx.MarginTop)) { fv.Page.isOk = false; fv.Page.MarginTop.isError = true; } fv.Page.MarginBottom.FileValue = docx.MarginBottom.ToString(); fv.Page.MarginBottom.DBValue = pageFilter.MarginBottom.ToString(); if (!(pageFilter.MarginBottom == docx.MarginBottom)) { fv.Page.isOk = false; fv.Page.MarginBottom.isError = true; } fv.Page.MarginLeft.FileValue = docx.MarginLeft.ToString(); fv.Page.MarginLeft.DBValue = pageFilter.MarginLeft.ToString(); if (!(pageFilter.MarginLeft == docx.MarginLeft)) { fv.Page.isOk = false; fv.Page.MarginLeft.isError = true; } fv.Page.MarginRight.FileValue = docx.MarginRight.ToString(); fv.Page.MarginRight.DBValue = pageFilter.MarginRight.ToString(); if (!(pageFilter.MarginRight == docx.MarginRight)) { fv.Page.isOk = false; fv.Page.MarginRight.isError = true; } } var ppt = PaperSize(docx.PageWidth, docx.PageHeight); fv.Page.PaperType.FileValue = ppt; fv.Page.PaperType.DBValue = pageFilter.PaperType; if (!(pageFilter.PaperType == ppt)) { fv.Page.isOk = false; fv.Page.PaperType.isError = true; } //duyệt list bộ lọc từ db foreach (var f in filter) { bool isOK = true; PropertiesView pv = new PropertiesView(); //get row check var r = paragraphs[f.Row]; //nếu 1 dòng có nhiều định dạng thì sai if (r.Paragraph.MagicText.Count > 1) { isOK = false; pv.Name += "Có quá nhiều định dạng, "; } else { var format = r.Paragraph.MagicText[0].formatting; if (!(f.Size == format.Size)) { isOK = false; pv.FontSize.isError = true; pv.FontSize.FileValue = format.Size.ToString(); pv.FontSize.DBValue = f.Size.ToString(); pv.Name += "Font Size không khớp, "; } if (!(f.Bold == format.Bold)) { if (format.Bold == null) { if (f.Bold) { pv.FontBold.isError = true; pv.FontBold.FileValue = null; pv.FontBold.DBValue = f.Bold.ToString(); pv.Name += "Font Bold không đọc được, "; } else { pv.FontBold.isError = false; pv.Name += "Font Bold không khớp, "; } } else { pv.FontBold.isError = true; pv.FontBold.FileValue = format.Bold.ToString(); pv.FontBold.DBValue = f.Bold.ToString(); isOK = false; pv.Name += "Font Bold không khớp, "; } pv.FontBold.isError = true; pv.FontBold.FileValue = format.Bold.ToString(); pv.FontBold.DBValue = f.Bold.ToString(); } if (!(f.Italic == format.Italic)) { if (format.Italic == null) { if (f.Italic) { pv.FontItalic.isError = true; pv.FontItalic.FileValue = null; pv.FontItalic.DBValue = f.Italic.ToString(); pv.Name += "Font Italic không đọc được, "; } else { pv.FontBold.isError = false; } } else { pv.FontItalic.isError = true; pv.FontItalic.FileValue = format.Italic.ToString(); pv.FontItalic.DBValue = f.Italic.ToString(); isOK = false; pv.Name += "Font Italic không khớp, "; } } if (format.FontFamily == null && pageFilter.FontFamily != null) { isOK = false; } else { if (!pageFilter.FontFamily.Equals(format.FontFamily.Name)) { if (format.FontFamily == null) { if (f.Italic) { fv.Page.FontFamily.isError = true; fv.Page.FontFamily.FileValue = null; fv.Page.FontFamily.DBValue = pageFilter.FontFamily; pv.Name += "Font Family không đọc được, "; } else { fv.Page.FontFamily.isError = false; } } else { fv.Page.FontFamily.isError = true; fv.Page.FontFamily.FileValue = format.FontFamily.Name; fv.Page.FontFamily.DBValue = pageFilter.FontFamily; isOK = false; pv.Name += "Font Family không khớp, "; } } } } if (!isOK) { fv.Properties[r.Paragraph.Text] = pv; } } ViewBag.Html = WordToHtml(ms); return(View(fv)); }
private void FilterListBox_MouseUp(object sender, MouseEventArgs e) { var index = FilterListBox.IndexFromPoint(e.Location); Select(index); if (e.Button != MouseButtons.Right) { return; } var contextmenu = new ContextMenuStrip { Renderer = new AccessKeyMenuStripRenderer() }; var add = new ToolStripMenuItem("Add...") { DropDown = FilterMenu() }; var remove = new ToolStripMenuItem("Remove"); remove.Click += (o, args) => { FilterSource.RemoveFilter(SelectedFilter); propertyPanel.Controls.Clear(); view = null; }; var top = new ToolStripMenuItem("Move to &Top"); top.Click += (o, args) => { Select(FilterSource.MoveItem(SelectedFilter, obs_order_movement.OBS_ORDER_MOVE_TOP)); }; var up = new ToolStripMenuItem("Move &Up"); up.Click += (o, args) => { Select(FilterSource.MoveItem(SelectedFilter, obs_order_movement.OBS_ORDER_MOVE_UP)); }; var down = new ToolStripMenuItem("Move &Down"); down.Click += (o, args) => { Select(FilterSource.MoveItem(SelectedFilter, obs_order_movement.OBS_ORDER_MOVE_DOWN)); }; var bottom = new ToolStripMenuItem("Move to &Bottom"); bottom.Click += (o, args) => { Select(FilterSource.MoveItem(SelectedFilter, obs_order_movement.OBS_ORDER_MOVE_BOTTOM)); }; if (SelectedFilter == null) { remove.Enabled = false; top.Enabled = false; up.Enabled = false; down.Enabled = false; bottom.Enabled = false; } if (index == 0) { top.Enabled = false; up.Enabled = false; } if (index == FilterSource.Filters.Count - 1) { down.Enabled = false; bottom.Enabled = false; } contextmenu.Items.AddRange(new ToolStripItem[] { add, remove, new ToolStripSeparator(), top, up, down, bottom }); contextmenu.Show(this, PointToClient(Cursor.Position)); }
private void propertiesToolStripMenuItem1_Click(object sender, EventArgs e) { PropertiesView propView = new PropertiesView(); propView.ShowDialog(); }
/// <summary> /// Show Properties View through set CurrentViewModel /// </summary> public void ShowPropertiesView() { CurrentViewModel = new PropertiesView { DataContext = new PropertiesViewModel(_listPropertyModels) }; }
/// <summary> /// Create a property dialog for an existing source /// </summary> /// <param name="source">Source of type ObsSource</param> public TestFilter(Source source) : this() { FilterSource = source; sourceSettings = FilterSource.GetSettings(); FilterListBox.DisplayMember = "Name"; FilterListBox.DataSource = FilterSource.Filters; oldfilters = FilterSource.Filters; undoButton.Enabled = false; defaultButton.Enabled = false; if (FilterSource.Filters.Any()) { Select(FilterSource.Filters.First()); undoButton.Enabled = true; defaultButton.Enabled = true; } defaultButton.Click += (sender, args) => { view.ResetToDefaults(); }; okButton.Click += (o, args) => { if (view != null) { view.UpdateSettings(); } DialogResult = DialogResult.OK; Close(); }; cancelButton.Click += (o, args) => { FilterSource.ClearFilters(); foreach (Filter oldfilter in oldfilters) { FilterSource.AddFilter(oldfilter); } DialogResult = DialogResult.Cancel; Close(); }; undoButton.Click += (sender, args) => { view.ResetChanges(); }; AddFilterButton.Click += (sender, args) => { FilterMenu().Show(this, PointToClient(Cursor.Position)); }; RemoveFilterButton.Click += (sender, args) => { if (SelectedFilter != null) { FilterSource.RemoveFilter(SelectedFilter); propertyPanel.Controls.Clear(); view = null; } }; }
public void SetWindows(OgreControl renderViewControl, TreeView treeControl, PropertiesView propsControl) { this.renderViewControl = renderViewControl; this.treeControl = treeControl; this.propsControl = propsControl; }