protected void btnAccept_Click(object sender, ImageClickEventArgs e) { if (template != null) { Patient patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); Professional professional = CntAriCli.GetProfessional(int.Parse(rdcProfessional.SelectedValue), ctx); IList<TemplateView> ltpw = new List<TemplateView>(); TemplateView tpvw = new TemplateView(); tpvw.Name = template.Name; string patientName = ""; if (patient != null) { patientName = String.Format("{0} {1}, {2}", patient.Surname1, patient.Surname2, patient.Name); } string professionalName = ""; if (professional != null) { professionalName = professional.FullName; } tpvw.Content = String.Format(template.Content, patientName, professionalName, txtCampo1.Text, txtCampo2.Text,txtCampo3.Text); ltpw.Add(tpvw); RptTemplate rpt = new RptTemplate(ltpw); ReportViewer1.Report = rpt; } }
protected void btnAccept_Click(object sender, ImageClickEventArgs e) { if (template != null) { Patient patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); Professional professional = CntAriCli.GetProfessional(int.Parse(rdcProfessional.SelectedValue), ctx); IList <TemplateView> ltpw = new List <TemplateView>(); TemplateView tpvw = new TemplateView(); tpvw.Name = template.Name; string patientName = ""; if (patient != null) { patientName = String.Format("{0} {1}, {2}", patient.Surname1, patient.Surname2, patient.Name); } string professionalName = ""; if (professional != null) { professionalName = professional.FullName; } tpvw.Content = String.Format(template.Content, patientName, professionalName, txtCampo1.Text, txtCampo2.Text, txtCampo3.Text); ltpw.Add(tpvw); RptTemplate rpt = new RptTemplate(ltpw); ReportViewer1.Report = rpt; } }
public TemplateView InsertTemplate(Template template) { TemplateView templateView = new TemplateView(); /* InstanceView ins = GetOneInstance(instance); * if (SUCCESS.Equals(ins.statusCode)) * { * instanceView.statusCode = FAILTURE; * } * else * { * instancedao.CreateInstance(instance); * instanceView.statusCode = SUCCESS; * instanceView.instance.Add(instance); * } */ bool result = this.templateRepositories.CreateTemplate(template); if (result) { templateView.StatusCode = SUCCESS; Template templateresult = this.templateRepositories.GetOneTemplate(template.Name, template.Type); List <Template> templatedata = new List <Template>(); templatedata.Add(templateresult); templateView.Data = templatedata; } else { templateView.StatusCode = FAILTURE; } return(templateView); }
private void BindAdMob(Holders.AdMobAdapterViewHolder holder) { try { Template = holder.MianAlert; AdLoader.Builder builder = new AdLoader.Builder(holder.MainView.Context, AppSettings.AdAdMobNativeKey); builder.ForUnifiedNativeAd(this); VideoOptions videoOptions = new VideoOptions.Builder() .SetStartMuted(true) .Build(); NativeAdOptions adOptions = new NativeAdOptions.Builder() .SetVideoOptions(videoOptions) .Build(); builder.WithNativeAdOptions(adOptions); AdLoader adLoader = builder.WithAdListener(new AdListener()).Build(); adLoader.LoadAd(new AdRequest.Builder().Build()); } catch (Exception e) { Console.WriteLine(e); } }
void InitializeComponents() { catStore = new Gtk.TreeStore(typeof(string), typeof(Category)); lst_template_types.Model = catStore; lst_template_types.WidthRequest = 160; lst_template_types.Selection.Changed += new EventHandler(CategoryChange); catColumn = new TreeViewColumn(); catColumn.Title = "categories"; cat_text_render = new CellRendererText(); catColumn.PackStart(cat_text_render, true); catColumn.AddAttribute(cat_text_render, "text", 0); lst_template_types.AppendColumn(catColumn); templateView = new TemplateView(); boxTemplates.Add(templateView); if (basePath == null) { basePath = IdeApp.ProjectOperations.ProjectsDefaultPath; } entry_location.Path = FileService.ResolveFullPath(basePath); PathChanged(null, null); templateView.SelectionChanged += SelectedIndexChange; templateView.DoubleClicked += OpenEvent; entry_location.PathChanged += PathChanged; InitializeView(); }
public TemplateView GetAllTemplate() { TemplateView templateView = new TemplateView(); List <Template> temp = this.templateRepositories.GetAllTemplate(); templateView.StatusCode = SUCCESS; templateView.Data = temp; return(templateView); }
/// <summary> /// open the template view / viewmodel to edit the selected template /// </summary> private void EditSelectedTemplate() { TemplateView window = new TemplateView(); window.DataContext = new TemplateViewModel(this.ItemService, "Update", this.SelectedTemplate); if (window.ShowDialog() == false) { PopulateTemplateList(); } }
/// <summary> /// Thread body /// </summary> /// <param name="state"></param> private void StartWork(object state) { TemplateView templateView = state as TemplateView; template savedTemplate = null; template theTemplate = new template(); templateView.Merge(theTemplate, editMode); AutoResetEvent nextOneAutoResetEvent = new AutoResetEvent(false); EventHandler <save_TemplateCompletedEventArgs> h1 = (s, e) => { // TODO: handle error from server side savedTemplate = e.Result; nextOneAutoResetEvent.Set(); }; Globals.WSClient.save_TemplateCompleted += h1; Globals.WSClient.save_TemplateAsync(theTemplate); nextOneAutoResetEvent.WaitOne(); Globals.WSClient.save_TemplateCompleted -= h1; // Check return result. If failure, savedCategory will be null if (savedTemplate != null) { this.Dispatcher.BeginInvoke(delegate() { templateView.Restore(new TemplateView(savedTemplate)); }); } else { // Show error message ShopproHelper.ShowMessageWindow(this, "Error", "Fail to save this entry.", false); // Back to readonly mode this.Dispatcher.BeginInvoke(delegate() { // Restore cached UI data templateView.CancelEdit(); this.dataForm.CancelEdit(); }); } // No unsaved item this.editMode = DataFormMode.ReadOnly; // Hide busy indicator ShopproHelper.HideBusyIndicator(this); // Go to original page if necessary if (this.ContentPageCtx.GotoAddNewPage) { ShopproHelper.GoBack(this); } }
public static List <IFilterDefinition> CreateInstances(TemplateView view, object dataSource) { Dictionary <BindingFilterDefinition, string> filterDefinitionByElement; if (view.FilterValueByFilterDefinitionByElement.TryGetValue(dataSource, out filterDefinitionByElement)) { IEnumerable <KeyValuePair <BindingFilterDefinition, string> > activeFilters = filterDefinitionByElement.Where(f => !string.IsNullOrEmpty(f.Value)); return(activeFilters.Select(af => (IFilterDefinition) new RootBindingFilter(view, af.Key, af.Value)).ToList()); } return(null); }
public AdMobAdapterViewHolder(View itemView) : base(itemView) { try { MainView = itemView; MianAlert = MainView.FindViewById <TemplateView>(Resource.Id.my_template); MianAlert.Visibility = ViewStates.Gone; } catch (Exception e) { Console.WriteLine(e); } }
public void DidReceiveUnifiedNativeAd(AdLoader adLoader, UnifiedNativeAd nativeAd) { Console.WriteLine("Received Ad!"); TemplateView templateView = View.NativeTemplate == AdMobNativeTemplates.Medium ? (TemplateView) new MediumTemplateView(Frame) : new SmallTemplateView(Frame); nativeAd.Delegate = this; SetNativeControl(templateView); templateView.SetNativeAd(nativeAd); templateView.AddHorizontalConstraintsToSuperviewWidth(); templateView.AddVerticalCenterConstraintToSuperview(); View?.TriggerAdRendered(); }
public TemplateView RemoveTemplate(Template template) { TemplateView templateView = new TemplateView(); bool result = this.templateRepositories.Remove(template.Name); if (result) { templateView.StatusCode = SUCCESS; } else { templateView.StatusCode = FAILTURE; } return(templateView); }
public void GetAllTemplateTest() { InitParamter(temp1, temp2, templates); ChangeViewData(temp1, templates, view); ChangeViewData(temp2, templates, view); TemplateDaoMock.Setup(f => f.GetAllTemplate()).Returns(view.Data); TemplateService impl = new TemplateService(TemplateDaoMock.Object); _view = impl.GetAllTemplate(); Assert.IsNotNull(_view); Assert.AreEqual(view.StatusCode, _view.StatusCode); Assert.AreEqual(view.Data.Count, _view.Data.Count); Assert.AreEqual(2, _view.Data.Count); }
public void RemoveTemplateTest() { InitParamter(temp1, temp2, templates); TemplateDaoMock.Setup(f => f.Remove(temp1.Name)).Returns(true); // TemplateDaoMock.Setup(f => f.Remove(temp1.Name)).Returns(false); TemplateService impl = new TemplateService(TemplateDaoMock.Object); _view = impl.RemoveTemplate(temp1); TemplateDaoMock.Setup(f => f.Remove(temp1.Name)).Returns(false); TemplateView tem_v = impl.RemoveTemplate(temp1); Assert.IsNotNull(_view); Assert.AreEqual(SUCCESS, _view.StatusCode); // Assert.AreEqual(FAILTURE, _view.StatusCode); }
public void UpdateTemplateTest() { InitParamter(temp1, temp2, templates); TemplateDaoMock.Setup(f => f.Update(temp1.Name, temp1)).Returns(true); TemplateDaoMock.Setup(f => f.GetOneTemplate(temp1.Name, temp1.Type)).Returns(temp1); TemplateService impl = new TemplateService(TemplateDaoMock.Object); _view = impl.UpdateTemplate(temp1); TemplateDaoMock.Setup(f => f.Update(temp1.Name, temp1)).Returns(false); TemplateView tem_v = impl.UpdateTemplate(temp1); foreach (Template template in _view.Data) { Assert.AreEqual(template.Name, temp1.Name); } Assert.AreEqual(SUCCESS, _view.StatusCode); }
public TemplateView GetOneTemplate(Template template) { TemplateView templateView = new TemplateView(); Template tem = this.templateRepositories.GetOneTemplate(template.Name, template.Type); if (tem == null) { templateView.StatusCode = FAILTURE; } else { templateView.StatusCode = SUCCESS; List <Template> tempaltes = new List <Template>(); tempaltes.Add(tem); templateView.Data = tempaltes; } return(templateView); }
public void GetOneTemplateTest() { InitParamter(temp1, temp2, templates); ChangeViewData(temp1, templates, view); Template tem3 = new Template(); tem3 = null; TemplateDaoMock.Setup(f => f.GetOneTemplate(temp1.Name, temp1.Type)).Returns(temp1); TemplateService impl = new TemplateService(TemplateDaoMock.Object); _view = impl.GetOneTemplate(temp1); // TemplateDaoMock.Setup(f => f.GetOneTemplate(temp1.Name, temp1.Type)).Returns(tem3); TemplateView tem_v = impl.GetOneTemplate(temp1); Assert.IsNotNull(_view); Assert.AreEqual(SUCCESS, _view.StatusCode); Assert.AreEqual(1, _view.Data.Count); }
public TemplateView UpdateTemplate(Template template) { TemplateView templateView = new TemplateView(); bool result = this.templateRepositories.Update(template.Name, template); if (result) { List <Template> templatedata = new List <Template>(); Template templateselect = this.templateRepositories.GetOneTemplate(template.Name, template.Type); templatedata.Add(templateselect); templateView.Data = templatedata; templateView.StatusCode = SUCCESS; } else { templateView.StatusCode = FAILTURE; } return(templateView); }
protected BindingFilterContextItem(ITemplateView view, BindingFilterDefinition bindingFilterDefinition, IBindingContextElement bindingContextElement) : base(bindingContextElement, null) { this.view = (TemplateView)view; this.bindingFilterDefinition = bindingFilterDefinition; this.bindingContextElement = bindingContextElement; Dictionary <BindingFilterDefinition, string> filterDefinitionByElement; if (!((TemplateView)view).FilterValueByFilterDefinitionByElement.TryGetValue(bindingContextElement.DataSource, out filterDefinitionByElement)) { filterDefinitionByElement = new Dictionary <BindingFilterDefinition, string>(); ((TemplateView)view).FilterValueByFilterDefinitionByElement[bindingContextElement.DataSource] = filterDefinitionByElement; } string filterValue; filterDefinitionByElement.TryGetValue(bindingFilterDefinition, out filterValue); FilterValue = filterValue; }
public void OnUnifiedNativeAdLoaded(UnifiedNativeAd ad) { // TODO: Show the ad. var view = Element as AdMobNativeView; if (adLoader.IsLoading) { // The AdLoader is still loading ads. // Expect more adLoaded or onAdFailedToLoad callbacks. view.TriggerAdLoading(); } else { // The AdLoader has finished loading ads. var styles = new NativeTemplateStyle { }; var template = new TemplateView(Context); var aview = template.InitView(Context, null, view.NativeTemplate); SetNativeControl(aview); template.SetStyles(styles); template.SetNativeAd(ad); view.TriggerAdRendered(); //var inflater = Context.GetSystemService(Context.LayoutInflaterService) // as LayoutInflater; // //var root = new UnifiedNativeAdView(Context); //var nativeAdView = (UnifiedNativeAdView) // inflater.Inflate(Resource.Layout.gnt_medium_template_view, root); // //nativeAdView.MediaView = nativeAdView.FindViewById<MediaView>(Resource.Id.media_view); // //nativeAdView.SetNativeAd(ad); } }
public void InsertTemplateTest() { Template tem3 = new Template(); tem3 = null; InitParamter(temp1, temp2, templates); TemplateDaoMock.Setup(f => f.CreateTemplate(temp1)).Returns(true); TemplateDaoMock.Setup(f => f.GetOneTemplate(temp1.Name, temp1.Type)).Returns(temp1); //TemplateDaoMock.Setup(f => f.CreateTemplate(temp1)).Returns(false); TemplateService impl = new TemplateService(TemplateDaoMock.Object); _view = impl.InsertTemplate(temp1); // TemplateDaoMock.Setup(f => f.CreateTemplate(temp1)).Returns(false); TemplateView tem_v = impl.InsertTemplate(temp1); // Assert.AreEqual(FAILTURE, _view.StatusCode); Assert.IsNotNull(_view); Assert.AreEqual(SUCCESS, _view.StatusCode); Assert.AreEqual(1, _view.Data.Count); Assert.AreEqual(true, _view.Data.Contains(temp1)); }
public static List <ParsRowView> GetViewList(XDCMessage XDCmsg, string msgCurrentFieldContent, int currentFSindex, ref int currXmlNodeIndex) { #region 修复12消息解析错误的问题 if (string.IsNullOrEmpty(msgCurrentFieldContent) && CurrentNode.ChildNodes.Count > currXmlNodeIndex) { XmlAttribute fieldName = CurrentNode.ChildNodes[currXmlNodeIndex].Attributes["Name"]; if (fieldName != null && fieldName.Value.StartsWith("FS")) { //解决存款消息中,310,311等buffer先生不正确的问题。edit by frde 20160106 if (fieldName.Value.Equals("FS")) { currXmlNodeIndex += 1; } return(null); } } #endregion List <ParsRowView> rowViewList = new List <ParsRowView>(); List <TemplateView> TvList = new List <TemplateView>(); int FSCountIndex = 0; bool isFSrepeat = false; bool isFoundFS_x = false; bool isOccurFS_x = false; int tempIndex = currXmlNodeIndex; if (CurrentNode == null) { return(rowViewList); } for (int i = tempIndex; i < CurrentNode.ChildNodes.Count; i++) { if (!isFSrepeat) { currXmlNodeIndex++; } TemplateView tv = new TemplateView(); XmlAttribute fieldName = CurrentNode.ChildNodes[i].Attributes["Name"]; XmlAttribute fieldSize = CurrentNode.ChildNodes[i].Attributes["Size"]; if (fieldName != null) { if (fieldName.Value.ToString() == "FS") { isOccurFS_x = false; FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); break; } else if (fieldName.Value.ToString().StartsWith("FS")) { isOccurFS_x = true; //if(string.IsNullOrEmpty(msgCurrentFieldContent)) //{ // FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); // currXmlNodeIndex = currXmlNodeIndex - 1; // isOccurFS_x = false; // break; //} if (TvList != null && TvList.Count > 0) { FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); currXmlNodeIndex = currXmlNodeIndex - 1; isOccurFS_x = false; break; } //FS*表示除了枚举的情况之外的所有通用情况 if (fieldName.Value == "FS*") { isOccurFS_x = false; if (TvList != null && TvList.Count > 0) { FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); break; } } else if (fieldName.Value == "FS**") { currXmlNodeIndex = currXmlNodeIndex - 1; isFSrepeat = true; isOccurFS_x = false; if (TvList != null && TvList.Count > 0) { FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); break; } } else { //如果当前消息域为空,且接下来都不是直接的FS,则直接跳过,XML节点下标向上跳回一个 //if (string.IsNullOrEmpty(msgCurrentFieldContent)) //{ // currXmlNodeIndex = currXmlNodeIndex - 1; // break; // //isFoundFS_x = false; // //continue; //} isFoundFS_x = false; string tempcontent = msgCurrentFieldContent; string tempStringBehind = fieldName.Value.Substring(2, fieldName.Value.Length - 2); string[] identifyArray = tempStringBehind.Split('|'); int tempLength = 0; string tempIde = ""; foreach (string ideItem in identifyArray) { tempLength = ideItem.Length; try { tempIde = tempcontent.Substring(0, tempLength); } catch { tempIde = ""; } if (tempIde == ideItem) { isFoundFS_x = true; TvList.Clear(); break; } } if (isFoundFS_x) { if (TvList != null && TvList.Count > 0) { FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); TvList.Clear(); break; } FSCountIndex++; } else { } } } else { //出现FS_x但是又没匹配上,接下来的都跳过 if (isOccurFS_x && !isFoundFS_x) { continue; } #region 普通节点,加入列表中( 永远为当前一个FS中的内容 ) tv.FieldName = fieldName.Value; int size; int.TryParse(fieldSize.Value, out size); tv.FieldSize = size; if (CurrentNode.ChildNodes[i].HasChildNodes) { Dictionary <string, string> dic = new Dictionary <string, string>(); foreach (XmlNode valueItem in CurrentNode.ChildNodes[i].ChildNodes) { XmlAttribute attrComment = valueItem.Attributes["Comment"]; XmlAttribute attrOperation = valueItem.Attributes["Operation"]; if (attrOperation != null) { //进行&运算 if (attrOperation.Value.StartsWith("&")) { //&运算 string ampValue = attrOperation.Value.Replace("&", ""); dic.Add(valueItem.InnerText + "&" + ampValue, attrComment.Value); } } else if (null != attrComment && !dic.ContainsKey(valueItem.InnerText)) { dic.Add(valueItem.InnerText, attrComment.Value); } } tv.FieldValue = dic; } TvList.Add(tv); #endregion } } else { } } if (TvList.Count > 0) { FindFinalFS(ref rowViewList, ref TvList, ref isFoundFS_x, msgCurrentFieldContent); isOccurFS_x = false; } return(rowViewList); }
void InitializeComponents() { iconView = new TemplateView(); iconView.ShowAll(); boxTemplates.PackStart(iconView, true, true, 0); catStore = new TreeStore(typeof(string), typeof(List <Category>), typeof(List <TemplateItem>)); TreeViewColumn treeViewColumn = new TreeViewColumn(); treeViewColumn.Title = "categories"; CellRenderer cellRenderer = new CellRendererText(); treeViewColumn.PackStart(cellRenderer, true); treeViewColumn.AddAttribute(cellRenderer, "text", 0); catView.AppendColumn(treeViewColumn); catStore.SetSortColumnId(0, SortType.Ascending); catView.Model = catStore; catView.SearchColumn = -1; // disable the interactive search okButton.Clicked += new EventHandler(OpenEvent); cancelButton.Clicked += new EventHandler(cancelClicked); nameEntry.Changed += new EventHandler(NameChanged); nameEntry.Activated += new EventHandler(OpenEvent); infoLabel.Text = string.Empty; labelTemplateTitle.Text = string.Empty; Project[] projects = null; if (parentProject == null) { projects = IdeApp.Workspace.GetAllProjects().ToArray(); } if (projects != null && projects.Length > 0) { Project curProject = IdeApp.ProjectOperations.CurrentSelectedProject; boxProject.Visible = true; projectAddCheckbox.Active = curProject != null; projectAddCheckbox.Toggled += new EventHandler(AddToProjectToggled); projectNames = new string[projects.Length]; projectRefs = new Project[projects.Length]; int i = 0; bool singleSolution = IdeApp.Workspace.Items.Count == 1 && IdeApp.Workspace.Items[0] is Solution; foreach (Project project in projects) { projectRefs[i] = project; if (singleSolution) { projectNames[i++] = project.Name; } else { projectNames[i++] = project.ParentSolution.Name + "/" + project.Name; } } Array.Sort(projectNames, projectRefs); i = Array.IndexOf(projectRefs, curProject); foreach (string pn in projectNames) { projectAddCombo.AppendText(pn); } projectAddCombo.Active = i != -1 ? i : 0; projectAddCombo.Sensitive = projectAddCheckbox.Active; projectAddCombo.Changed += new EventHandler(AddToProjectComboChanged); projectPathLabel.Sensitive = projectAddCheckbox.Active; projectFolderEntry.Sensitive = projectAddCheckbox.Active; if (curProject != null) { projectFolderEntry.Path = curProject.BaseDirectory; } projectFolderEntry.PathChanged += new EventHandler(AddToProjectPathChanged); if (curProject != null) { basePath = curProject.BaseDirectory; parentProject = curProject; } } else { boxProject.Visible = false; } catView.Selection.Changed += new EventHandler(CategoryChange); catView.RowActivated += new RowActivatedHandler(CategoryActivated); iconView.SelectionChanged += new EventHandler(SelectedTemplateChanged); iconView.DoubleClicked += new EventHandler(OpenEvent); InitializeDialog(false); InitializeView(); UpdateOkStatus(); }
/// <inheritdoc/> public override IDock CreateDefaultLayout() { // Dashboard var dashboardView = new DashboardView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Dashboard" }; // Page var pageView = new PageView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Page" }; // Left / Top var projectView = new ProjectView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Project" }; var optionsView = new OptionsView { Dock = "", Width = 200, Height = 200, Title = "Options" }; var imagesView = new ImagesView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Images" }; // Left / Bottom var groupsView = new GroupsView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Groups" }; var databasesView = new DatabasesView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Databases" }; // Right / Top var stylesView = new StylesView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Styles" }; var templatesView = new TemplatesView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Templates" }; var containerView = new ContainerView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Container" }; var zoomView = new ZoomView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Zoom" }; // Right / Bottom var toolsView = new ToolsView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Tools" }; var shapeView = new ShapeView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Shape" }; var dataView = new DataView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Data" }; var styleView = new StyleView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Style" }; var templateView = new TemplateView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Template" }; // Left var leftPane = new DockLayout { Dock = "Left", Width = 200, Height = double.NaN, Title = "EditorLeft", CurrentView = null, Views = new ObservableCollection <IDock> { new DockStrip { Dock = "Top", Width = double.NaN, Height = 340, Title = "EditorLeftTop", CurrentView = projectView, Views = new ObservableCollection <IDock> { projectView, optionsView, imagesView } }, new DockSplitter() { Dock = "Top", Title = "LeftTopSplitter" }, new DockStrip { Dock = "Bottom", Width = double.NaN, Height = double.NaN, Title = "EditorLeftBottom", CurrentView = groupsView, Views = new ObservableCollection <IDock> { groupsView, databasesView } } } }; // Right var rightPane = new DockLayout { Dock = "Right", Width = 240, Height = double.NaN, Title = "EditorRight", CurrentView = null, Views = new ObservableCollection <IDock> { new DockStrip { Dock = "Top", Width = double.NaN, Height = 340, Title = "EditorRightTop", CurrentView = stylesView, Views = new ObservableCollection <IDock> { stylesView, templatesView, containerView, zoomView } }, new DockSplitter() { Dock = "Top", Title = "RightTopSplitter" }, new DockStrip { Dock = "Bottom", Width = double.NaN, Height = double.NaN, Title = "EditorRightBottom", CurrentView = toolsView, Views = new ObservableCollection <IDock> { toolsView, shapeView, dataView, styleView, templateView } } } }; // Editor var editorLayout = new DockLayout { Dock = "", Width = double.NaN, Height = double.NaN, Title = "EditorLayout", CurrentView = null, Views = new ObservableCollection <IDock> { leftPane, new DockSplitter() { Dock = "Left", Title = "LeftSplitter" }, rightPane, new DockSplitter() { Dock = "Right", Title = "RightSplitter" }, pageView } }; var editorView = new EditorView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Editor", CurrentView = editorLayout, Views = new ObservableCollection <IDock> { editorLayout } }; // About var aboutView = new AboutView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "About" }; // Browser var browserView = new BrowserView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Browser" }; // Document var documentView = new DocumentView { Dock = "", Width = double.NaN, Height = double.NaN, Title = "Document" }; // Main var layout = new DockRoot { Dock = "", Width = double.NaN, Height = double.NaN, CurrentView = dashboardView, Views = new ObservableCollection <IDock> { dashboardView, editorView, aboutView, browserView, documentView } }; return(layout); }
private RootBindingFilter(ITemplateView view, BindingFilterDefinition bindingFilterDefinition, string filterValue) { this.view = (TemplateView)view; this.bindingFilterDefinition = bindingFilterDefinition; FilterValue = filterValue; }
/// <summary> /// The execute templates command. /// </summary> private void ExecuteTemplatesCommand() { var templatesview = new TemplateView(); templatesview.ShowDialog(); }
void InitializeComponents () { iconView = new TemplateView (); iconView.ShowAll (); boxTemplates.PackStart (iconView, true, true, 0); catStore = new TreeStore (typeof(string), typeof(List<Category>), typeof(List<TemplateItem>)); TreeViewColumn treeViewColumn = new TreeViewColumn (); treeViewColumn.Title = "categories"; CellRenderer cellRenderer = new CellRendererText (); treeViewColumn.PackStart (cellRenderer, true); treeViewColumn.AddAttribute (cellRenderer, "text", 0); catView.AppendColumn (treeViewColumn); catStore.SetSortColumnId (0, SortType.Ascending); catView.Model = catStore; okButton.Clicked += new EventHandler (OpenEvent); cancelButton.Clicked += new EventHandler (cancelClicked); nameEntry.Changed += new EventHandler (NameChanged); nameEntry.Activated += new EventHandler (OpenEvent); infoLabel.Text = string.Empty; labelTemplateTitle.Text = string.Empty; Project[] projects = null; if (parentProject == null) projects = IdeApp.Workspace.GetAllProjects ().ToArray (); if (projects != null && projects.Length > 0) { Project curProject = IdeApp.ProjectOperations.CurrentSelectedProject; boxProject.Visible = true; projectAddCheckbox.Active = curProject != null; projectAddCheckbox.Toggled += new EventHandler (AddToProjectToggled); projectNames = new string[projects.Length]; projectRefs = new Project[projects.Length]; int i = 0; bool singleSolution = IdeApp.Workspace.Items.Count == 1 && IdeApp.Workspace.Items[0] is Solution; foreach (Project project in projects) { projectRefs[i] = project; if (singleSolution) projectNames[i++] = project.Name; else projectNames[i++] = project.ParentSolution.Name + "/" + project.Name; } Array.Sort (projectNames, projectRefs); i = Array.IndexOf (projectRefs, curProject); foreach (string pn in projectNames) projectAddCombo.AppendText (pn); projectAddCombo.Active = i != -1 ? i : 0; projectAddCombo.Sensitive = projectAddCheckbox.Active; projectAddCombo.Changed += new EventHandler (AddToProjectComboChanged); projectPathLabel.Sensitive = projectAddCheckbox.Active; projectFolderEntry.Sensitive = projectAddCheckbox.Active; if (curProject != null) projectFolderEntry.Path = curProject.BaseDirectory; projectFolderEntry.PathChanged += new EventHandler (AddToProjectPathChanged); if (curProject != null) { basePath = curProject.BaseDirectory; parentProject = curProject; } } else { boxProject.Visible = false; } catView.Selection.Changed += new EventHandler (CategoryChange); catView.RowActivated += new RowActivatedHandler (CategoryActivated); iconView.SelectionChanged += new EventHandler (SelectedTemplateChanged); iconView.DoubleClicked += new EventHandler (OpenEvent); InitializeDialog (false); InitializeView (); UpdateOkStatus (); }
// // GET: /Template/ public ActionResult Index() { try { if (Session["UserAccountID"] == null) return RedirectToAction("Validate", "Login"); User user = (User)Session["User"]; ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"])); if (user.IsAdmin) ViewData["txtIsAdmin"] = "true"; else ViewData["txtIsAdmin"] = "false"; // Initialize or get the page state using session TemplatePageState pagestate = GetPageState(); // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); // Set and save the page state to the submitted form values if any values are passed if (Request.Form["lstAscDesc"] != null) { pagestate.AccountID = accountid; pagestate.TemplateName = Request.Form["txtTemplateName"].ToString().Trim(); if (Request.Form["chkOnlyApproved"].ToLower().StartsWith("true")) pagestate.OnlyApproved = true; else pagestate.OnlyApproved = false; if (Request.Form["chkIncludeInactive"].ToLower().StartsWith("true")) pagestate.IncludeInactive = true; else pagestate.IncludeInactive = false; pagestate.SortBy = Request.Form["lstSortBy"].ToString().Trim(); pagestate.AscDesc = Request.Form["lstAscDesc"].ToString().Trim(); pagestate.PageNumber = Convert.ToInt32(Request.Form["txtPageNumber"].ToString().Trim()); SavePageState(pagestate); } // Add the session values to the view data so they can be populated in the form ViewData["AccountID"] = pagestate.AccountID; ViewData["TemplateName"] = pagestate.TemplateName; ViewData["OnlyApproved"] = pagestate.OnlyApproved; ViewData["IncludeInactive"] = pagestate.IncludeInactive; ViewData["SortBy"] = pagestate.SortBy; ViewData["SortByList"] = new SelectList(BuildSortByList(), "Value", "Text", pagestate.SortBy); ViewData["AscDescList"] = new SelectList(BuildAscDescList(), "Value", "Text", pagestate.AscDesc); // Determine asc/desc bool isdescending = false; if (pagestate.AscDesc.ToLower().StartsWith("d")) isdescending = true; // Get a Count of all filtered records int recordcount = repository.GetTemplateRecordCount(pagestate.AccountID, pagestate.TemplateName, pagestate.OnlyApproved, pagestate.IncludeInactive); // Determine the page count int pagecount = 1; if (recordcount > 0) { pagecount = recordcount / Constants.PageSize; if (recordcount % Constants.PageSize != 0) // Add a page if there are more records { pagecount = pagecount + 1; } } // Make sure the current page is not greater than the page count if (pagestate.PageNumber > pagecount) { pagestate.PageNumber = pagecount; SavePageState(pagestate); } // Set the page number and account in viewdata ViewData["PageNumber"] = Convert.ToString(pagestate.PageNumber); ViewData["PageCount"] = Convert.ToString(pagecount); ViewData["RecordCount"] = Convert.ToString(recordcount); IEnumerable<Template> templates = repository.GetTemplatePage(pagestate.AccountID, pagestate.TemplateName, pagestate.OnlyApproved, pagestate.IncludeInactive, pagestate.SortBy, isdescending, pagestate.PageNumber, pagecount); ITemplateContentRepository templatecontentrepository = new EntityTemplateContentRepository(); List<TemplateView> templateviews = new List<TemplateView>(); foreach (Template template in templates) { TemplateView templateview = new TemplateView(); templateview.TemplateID = template.TemplateID; templateview.AccountID = template.AccountID; templateview.TemplateGUID = template.TemplateGUID; templateview.TemplateName = template.TemplateName; templateview.TemplateDescription = template.TemplateDescription; templateview.Rows = template.Rows; templateview.Columns = template.Columns; templateview.IsApproved = template.IsApproved; templateview.IsActive = template.IsActive; IEnumerable<TemplateContent> templatecontents = templatecontentrepository.GetTemplateContents(template.TemplateID); if (templatecontents != null && templatecontents.Count() > 0) templateview.ContentCount = templatecontents.Count(); else templateview.ContentCount = 0; templateviews.Add(templateview); } ViewResult result = View(templateviews); result.ViewName = "Index"; return result; } catch (Exception ex) { Helpers.SetupApplicationError("Template", "Index", ex.Message); return RedirectToAction("Index", "ApplicationError"); } }
public void Mode_Show() { using(DataTable items = new DataAdapter().Select("ID", "START_DATE", "END_DATE", "NAME", "DESCRIPTION") .From("BROADCASTING").JoinExt("TEXT") .OrderBy("START_DATE", true) .GetData()) { TemplateView template = new TemplateView("broadcasting_list"); template.Items.Add("datatable", items); template.Items.Add("moduleroot", this.ModuleRoot); template.Items.Add("isadmin", WebUser.Current.IsInRole(EditorRole)); template.Items.Add("lang", Lang); Controls.Add(template); } }
// // GET: /Template/ public ActionResult Index() { try { if (Session["UserAccountID"] == null) { return(RedirectToAction("Validate", "Login")); } User user = (User)Session["User"]; ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"])); if (user.IsAdmin) { ViewData["txtIsAdmin"] = "true"; } else { ViewData["txtIsAdmin"] = "false"; } // Initialize or get the page state using session TemplatePageState pagestate = GetPageState(); // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) { accountid = Convert.ToInt32(Session["UserAccountID"]); } // Set and save the page state to the submitted form values if any values are passed if (Request.Form["lstAscDesc"] != null) { pagestate.AccountID = accountid; pagestate.TemplateName = Request.Form["txtTemplateName"].ToString().Trim(); if (Request.Form["chkOnlyApproved"].ToLower().StartsWith("true")) { pagestate.OnlyApproved = true; } else { pagestate.OnlyApproved = false; } if (Request.Form["chkIncludeInactive"].ToLower().StartsWith("true")) { pagestate.IncludeInactive = true; } else { pagestate.IncludeInactive = false; } pagestate.SortBy = Request.Form["lstSortBy"].ToString().Trim(); pagestate.AscDesc = Request.Form["lstAscDesc"].ToString().Trim(); pagestate.PageNumber = Convert.ToInt32(Request.Form["txtPageNumber"].ToString().Trim()); SavePageState(pagestate); } // Add the session values to the view data so they can be populated in the form ViewData["AccountID"] = pagestate.AccountID; ViewData["TemplateName"] = pagestate.TemplateName; ViewData["OnlyApproved"] = pagestate.OnlyApproved; ViewData["IncludeInactive"] = pagestate.IncludeInactive; ViewData["SortBy"] = pagestate.SortBy; ViewData["SortByList"] = new SelectList(BuildSortByList(), "Value", "Text", pagestate.SortBy); ViewData["AscDescList"] = new SelectList(BuildAscDescList(), "Value", "Text", pagestate.AscDesc); // Determine asc/desc bool isdescending = false; if (pagestate.AscDesc.ToLower().StartsWith("d")) { isdescending = true; } // Get a Count of all filtered records int recordcount = repository.GetTemplateRecordCount(pagestate.AccountID, pagestate.TemplateName, pagestate.OnlyApproved, pagestate.IncludeInactive); // Determine the page count int pagecount = 1; if (recordcount > 0) { pagecount = recordcount / Constants.PageSize; if (recordcount % Constants.PageSize != 0) // Add a page if there are more records { pagecount = pagecount + 1; } } // Make sure the current page is not greater than the page count if (pagestate.PageNumber > pagecount) { pagestate.PageNumber = pagecount; SavePageState(pagestate); } // Set the page number and account in viewdata ViewData["PageNumber"] = Convert.ToString(pagestate.PageNumber); ViewData["PageCount"] = Convert.ToString(pagecount); ViewData["RecordCount"] = Convert.ToString(recordcount); IEnumerable <Template> templates = repository.GetTemplatePage(pagestate.AccountID, pagestate.TemplateName, pagestate.OnlyApproved, pagestate.IncludeInactive, pagestate.SortBy, isdescending, pagestate.PageNumber, pagecount); ITemplateContentRepository templatecontentrepository = new EntityTemplateContentRepository(); List <TemplateView> templateviews = new List <TemplateView>(); foreach (Template template in templates) { TemplateView templateview = new TemplateView(); templateview.TemplateID = template.TemplateID; templateview.AccountID = template.AccountID; templateview.TemplateGUID = template.TemplateGUID; templateview.TemplateName = template.TemplateName; templateview.TemplateDescription = template.TemplateDescription; templateview.Rows = template.Rows; templateview.Columns = template.Columns; templateview.IsApproved = template.IsApproved; templateview.IsActive = template.IsActive; IEnumerable <TemplateContent> templatecontents = templatecontentrepository.GetTemplateContents(template.TemplateID); if (templatecontents != null && templatecontents.Count() > 0) { templateview.ContentCount = templatecontents.Count(); } else { templateview.ContentCount = 0; } templateviews.Add(templateview); } ViewResult result = View(templateviews); result.ViewName = "Index"; return(result); } catch (Exception ex) { Helpers.SetupApplicationError("Template", "Index", ex.Message); return(RedirectToAction("Index", "ApplicationError")); } }
protected BindingSearchContextItem(ITemplateView view, BindingSearchDefinition definition, IBindingContextElement parent) : base(parent, null) { this.view = (TemplateView)view; this.definition = definition; }
public List <ParsRowView> GetView(string parsText) { List <ParsRowView> result = new List <ParsRowView>(); //NDC string attrProtocolType = "2"; //State string attrDataType = "1"; string attrKey = ""; if (parsText.Contains(" ")) { attrKey = parsText.Substring(0, parsText.IndexOf(" ")); } else { attrKey = parsText.Substring(0, 1); } XmlNode cur = XDCUnity.GetNodeDetail(XDCUnity.Root, attrKey, attrProtocolType, attrDataType); if (cur == null) { //NDC OR DDC attrProtocolType = "0"; cur = XDCUnity.GetNodeDetail(XDCUnity.Root, attrKey, attrProtocolType, attrDataType); } if (cur != null) { int curIndex = 0; foreach (XmlNode item in cur.ChildNodes) { TemplateView tv = new TemplateView(); XmlAttribute fieldName = item.Attributes["Name"]; XmlAttribute fieldSize = item.Attributes["Size"]; ParsRowView prv = new ParsRowView(); int size; int.TryParse(fieldSize.Value, out size); string tempValue = ""; string tempComment = ""; try { tempValue = parsText.Substring(curIndex, size); curIndex += size; } catch { if (parsText.Length - curIndex > 0) { tempValue = parsText.Substring(curIndex, parsText.Length - curIndex); } else { tempValue = ""; } tempComment = "Invalid Length"; curIndex += size; } if (string.IsNullOrEmpty(tempComment) && item.HasChildNodes) { bool isFindComment = false; bool isStartFound = false; foreach (XmlNode commentItem in item.ChildNodes) { string commentValue = commentItem.InnerText; string commentText = commentItem.Attributes["Comment"].Value; if (tempValue.Equals(commentValue.Trim()) || commentValue.Trim() == "*") { tempComment = commentText; isFindComment = true; break; } } if (!isFindComment) { tempComment = "UnKnow Value"; } } result.Add(new ParsRowView(fieldName.Value.ToString(), tempValue, tempComment)); } return(result); } else { return(null); } }
public List <ParsRowView> GetView(string parsText) { List <ParsRowView> result = new List <ParsRowView>(); //NDC OR DDC string attrProtocolType = "0"; //State string attrDataType = "3"; XmlNode cur = XDCUnity.GetNodeDetail(XDCUnity.Root, attrProtocolType, attrDataType); if (cur == null) { //NDC OR DDC attrProtocolType = "0"; cur = XDCUnity.GetNodeDetail(XDCUnity.Root, attrProtocolType, attrDataType); } if (cur != null) { //each 3 bit for one group,this values will be used as the base value to calculate for hex. List <string> parsTextInList = new List <string>(); string SingFieldText = string.Empty; for (int i = 0; i < parsText.Length; i++) { SingFieldText += parsText[i]; if ((i + 1) % 3 == 0) { parsTextInList.Add(SingFieldText); SingFieldText = ""; } } string tempValue = ""; string tempValueBeforHex = ""; int listIndex = 0; foreach (XmlNode item in cur.ChildNodes) { TemplateView tv = new TemplateView(); XmlAttribute fieldName = item.Attributes["Name"]; XmlAttribute fieldSize = item.Attributes["Size"]; ParsRowView prv = new ParsRowView(); tempValue = ""; tempValueBeforHex = ""; int size; int.TryParse(fieldSize.Value, out size); int realSize = size / 3;// 3 bit to calculate for hex value--frde 20151117 string tempComment = ""; for (int i = 0; i < realSize; i++) { try { //可能缺少数据的情况 tempValue += int.Parse(parsTextInList[listIndex]).ToString("X2"); tempValueBeforHex += parsTextInList[listIndex]; } catch { tempComment = "Invalid Length"; } finally { listIndex++; } } if (string.IsNullOrEmpty(tempComment) && item.HasChildNodes) { foreach (XmlNode commentItem in item.ChildNodes) { string commentValue = commentItem.InnerText; string commentText = commentItem.Attributes["Comment"].Value; XmlAttribute commentIsOperation = commentItem.Attributes["Operation"]; if (null != commentIsOperation) { if (commentIsOperation.Value.StartsWith("&")) { //&运算 string ampValue = commentIsOperation.Value.Replace("&", ""); int ampResult = int.Parse(tempValueBeforHex) & int.Parse(ampValue); //string hexValue = ampResult.ToString("X2"); if (ampResult == int.Parse(commentValue)) { tempComment = commentText; break; } } } else if (tempValue.Equals(commentValue.Trim())) { tempComment = commentText; } } } result.Add(new ParsRowView(fieldName.Value.ToString(), tempValue, tempComment)); } return(result); } else { return(null); } }
/// <summary> /// 获取xml节点列表 /// </summary> /// <returns></returns> public static List <TemplateView> GetXmlConfig(XDCMessage CurrentMessage) { string[] tempArrary = CurrentMessage.MsgASCIIStringFields; XmlNode root = null; string attrID = ""; //1NDC|2DDC string attrProtocolType = "2"; //1State //2Screen //3Fit //4Message string attrDataType = "4"; XmlNode cur = null; string commandCode = ""; string MessageIdentifier = ""; int sdIndex = 3; root = XMLHelper.instance.XMLFiles["ProtocolTemplate"].XmlDoc.SelectSingleNode("ProtocolTemplate"); switch (CurrentMessage.MsgType) { case MessageType.DataCommand: { #region 3x_DataCommand commandCode = tempArrary[3].Substring(0, 1); MessageIdentifier = commandCode; attrID = "3FSFSFS" + commandCode; cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); if (null == cur) { //通常查询xml文件中ID=1的配置 attrID = tempArrary[0].Substring(0, 1); cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); } #endregion } break; case MessageType.TerminalCommand: { #region 1x_TerminalCommand commandCode = tempArrary[3].Substring(0, 1); //TerminalCommand消息中,MessageIdentifier的值等于commandCode,因为 //TerminalCommand消息LUNO号后只有一个FS MessageIdentifier = commandCode; attrID = "1FSFSFS" + commandCode; cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); if (null == cur) { //通常查询xml文件中ID=1的配置 attrID = tempArrary[0].Substring(0, 1); cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); } #endregion } break; case MessageType.SolicitedMessage: { #region 22||23_SolicitedMessage attrID = tempArrary[0] + "FSFSFS"; int fsCount = 3; try { commandCode = tempArrary[sdIndex].Substring(0, 1); } catch { commandCode = ""; } if (tempArrary.Length > sdIndex + 1) { MessageIdentifier = tempArrary[sdIndex + 1].Substring(0, 1); } attrID += commandCode; string tempXMLid = ""; string miString = ""; if (commandCode == "8" || commandCode == "C" || commandCode == "F") { miString = "FS" + MessageIdentifier; fsCount++; } int maxFsCountRear = tempArrary.Length - fsCount - 1; //最多的FS,并逐个递减 while (maxFsCountRear > -1) { tempXMLid = attrID + miString + XDCUnity.GetFS(maxFsCountRear); cur = XDCUnity.GetNodeDetail(root, tempXMLid, attrProtocolType, attrDataType); if (null != cur) { break; } maxFsCountRear--; } //如果还未空,去掉MessageIdentifier if (null == cur) { tempXMLid = attrID; cur = XDCUnity.GetNodeDetail(root, tempXMLid, attrProtocolType, attrDataType); if (null == cur) { tempXMLid = tempArrary[0]; cur = XDCUnity.GetNodeDetail(root, tempXMLid, attrProtocolType, attrDataType); } } #endregion } break; case MessageType.UnSolicitedMessage: { #region 12||11_UnSolicitedMessage try { commandCode = tempArrary[3].Substring(0, 1); } catch { commandCode = ""; } MessageIdentifier = commandCode; attrID = tempArrary[0] + "FSFSFS" + commandCode; if (tempArrary[0].Equals("11")) { try { MessageIdentifier = tempArrary[13].Substring(0, 1); } catch { MessageIdentifier = ""; } } cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); if (null == cur) { attrID = tempArrary[0]; cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); } #endregion } break; case MessageType.TransactionReplyCommand: { #region 4_TransactionReplyCommand //扩张功能命令:‘ attrID = "4"; if (CurrentMessage.MsgASCIIString.Contains(XDCSplictorChar.FS + "'")) { MessageIdentifier = "'"; } cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); #endregion } break; case MessageType.UploadEJMessage: { #region 6x_UploadEJMessage try { commandCode = tempArrary[3].Substring(0, 1); MessageIdentifier = commandCode; } catch { commandCode = ""; MessageIdentifier = commandCode; } attrID = tempArrary[0].Substring(0, tempArrary[0].Length); cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); if (null == cur) { attrID = tempArrary[0].Substring(0, 1); cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); } #endregion } break; case MessageType.ExitToHostMessages: { } break; case MessageType.HostToExitMessages: { #region 7_HostToExitMessages attrID = tempArrary[0].Substring(0, 1); cur = XDCUnity.GetNodeDetail(root, attrID, attrProtocolType, attrDataType); #endregion } break; case MessageType.Unknow: break; default: break; } if (null == cur) { return(null); } bool alreadyFS_X = true; List <TemplateView> TvList = new List <TemplateView>(); foreach (XmlNode item in cur.ChildNodes) { TemplateView tv = new TemplateView(); XmlAttribute fieldName = item.Attributes["Name"]; XmlAttribute fieldSize = item.Attributes["Size"]; if (fieldName != null) { tv.FieldName = fieldName.Value; } if ((tv.FieldName.StartsWith("FS") && tv.FieldName.Length > 2) || (tv.FieldName.StartsWith("GS") && tv.FieldName.Length > 2)) { if (tv.FieldName.Contains('|')) { string[] fsSpliterArray = tv.FieldName.Replace("FS", "").Split('|'); foreach (string fsSpliterStr in fsSpliterArray) { if (MessageIdentifier == fsSpliterStr) { tv.FieldName = "FS"; alreadyFS_X = true; break; } else { alreadyFS_X = false; } } if (!alreadyFS_X) { continue; } } else if (tv.FieldName.Equals("FS" + "*")) { //找到FS* tv.FieldName = "FS*"; alreadyFS_X = true; } //已FS开头,但是不等於FS/GS的需要越过两行 else if (!tv.FieldName.Equals("FS" + MessageIdentifier) && !tv.FieldName.Equals("GS" + MessageIdentifier)) { string tempDeviceID = ""; if (DDCdeviceID.CheckDeviceID(tv.FieldName.Substring(2, tv.FieldName.Length - 2), out tempDeviceID)) { tv.FieldName = tv.FieldName.Substring(0, 2); alreadyFS_X = true; } else { alreadyFS_X = false; continue; } } else { tv.FieldName = tv.FieldName.Substring(0, 2); alreadyFS_X = true; } } else if (tv.FieldName.Equals("FS")) { alreadyFS_X = true; } if (!alreadyFS_X) { continue; } if (fieldSize != null) { int fSize; bool isNumeric = int.TryParse(fieldSize.Value, out fSize); if (isNumeric) { tv.FieldSize = fSize; } else { //非数字的情况,如* tv.FieldSize = -1; } } if (item.HasChildNodes) { Dictionary <string, string> dic = new Dictionary <string, string>(); foreach (XmlNode valueItem in item.ChildNodes) { XmlAttribute attrComment = valueItem.Attributes["Comment"]; XmlAttribute attrOperation = valueItem.Attributes["Operation"]; if (attrOperation != null) { //进行&运算 if (attrOperation.Value.StartsWith("&")) { //&运算 string ampValue = attrOperation.Value.Replace("&", ""); dic.Add(valueItem.InnerText + "&" + ampValue, attrComment.Value); } } else if (null != attrComment && !dic.ContainsKey(valueItem.InnerText)) { dic.Add(valueItem.InnerText, attrComment.Value); } } tv.FieldValue = dic; } TvList.Add(tv); } return(TvList); }
public void ChangeViewData(Template temp, List <Template> templates, TemplateView view) { templates.Add(temp); view.Data = templates; view.StatusCode = SUCCESS; }