日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
Silverlight快速開(kāi)發(fā)框架RapidSL新特性

對(duì)sl傳統(tǒng)的開(kāi)發(fā)方式進(jìn)行了集成和封裝,核心模塊基于MVVM,通用的CRUD ViewModel,只需要定制自己的Xaml View,提供了非常便捷的快速開(kāi)發(fā)方式; 采用了Silverlight 5.0 + EF4.1 Code First + Ria Service SP2 + Ria Service Toolkit + Silverlight Control Toolkit + Light MVVM;已經(jīng)實(shí)現(xiàn)了輕量級(jí)的權(quán)限管理,上傳模塊,內(nèi)容管理,作為實(shí)例,涉及到了sl開(kāi)發(fā)的各種技術(shù)難點(diǎn)和技巧,既可以作為學(xué)習(xí),也可以作為項(xiàng)目開(kāi)發(fā)的原型

點(diǎn)擊預(yù)覽 | 源代碼

支持動(dòng)態(tài)加載.xap,面向插件開(kāi)發(fā)

RapidSL.SL.App.Portal提供主框架的UI邏輯,只需要開(kāi)發(fā)自己的App,如RapidSL.SL.App.Main

然后配置菜單:

 
 
 
 
  1.                                 
  2.                                 
  3.                            

XapHost控件提供動(dòng)態(tài)下載.xap及加載

 
 
 
 
  1. public XapHost(string xapUri, string viewName = null)
  2.          {
  3.              InitializeComponent();
  4.              this.FileName = xapUri;
  5.              var xapLoad = new XapLoader(xapUri);
  6.              xapLoad.DownloadProgressChanged += (s, e) =>
  7.              {
  8.                  this.TotalSize = (e.TotalBytesToReceive * 1d / 1024 / 1024).ToString("0.00");
  9.                  this.Percentage = e.ProgressPercentage;
  10.              };
  11.              xapLoad.LoadCompleted += (s, e) =>
  12.              {
  13.                  this.Content = e.Element;
  14.              };
  15.              xapLoad.LoadControl(null, viewName);
  16.          }

對(duì)Resource的支持

找到所有標(biāo)識(shí)有 StaticResourceAttribute的類,然后創(chuàng)建相關(guān)實(shí)例,并注入到Application.Resources,相當(dāng)于在 App.xaml里手寫資源

實(shí)現(xiàn)了資源管理器對(duì)資源進(jìn)行注入管理

 
 
 
 
  1. View Code 
  2.  public class ViewModelManager
  3.      {
  4.          private static Application app = Application.Current; 
  5.          public static void InjectViewModelsToResources()
  6.          {
  7.              foreach (AssemblyPart ap in Deployment.Current.Parts)
  8.              {
  9.                  var sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
  10.                  var assembly = new AssemblyPart().Load(sri.Stream);
  11.  
  12.                  InjectViewModelsToResources(assembly);             
  13.              } 
  14.          } 
  15.          public static void InjectViewModelsToResources(Assembly assembly)
  16.          {
  17.              foreach (Type type in assembly.GetTypes())
  18.              {
  19.                  var attributes = type.GetCustomAttributes(false);
  20.  
  21.                  foreach (var attribute in attributes)
  22.                  {
  23.                      if (attribute is StaticResourceAttribute)
  24.                      {
  25.                          var resourceKey = ((StaticResourceAttribute)attribute).Key;
  26.                          if (string.IsNullOrEmpty(resourceKey))
  27.                              resourceKey = type.Name; 
  28.                          var obj = Activator.CreateInstance(type);
  29.                          if (!app.Resources.Contains(resourceKey))
  30.                              app.Resources.Add(resourceKey, obj);
  31.                      }
  32.                  }
  33.              }
  34.          }
  35.          public static T GetViewModelFromResources()
  36.          {
  37.              var key = typeof(T).Name;
  38.              if (app.Resources.Contains(key))
  39.                  return (T)app.Resources[key];
  40.              else
  41.                  return default(T);
  42.          }
  43.      }

鍵盤Enter鍵提交表單

使用AttatchProperty實(shí)現(xiàn)傳統(tǒng)Html表單的鍵盤Enter提交

 
 
 
 

具體綁定按鈕和鍵盤事件

 
 
 
 
  1. #region SubmitButton AttachProperty
  2.          public static object GetSubmitButton(DependencyObject obj)
  3.          {
  4.              return (object)obj.GetValue(SubmitButtonProperty);
  5.          }
  6.  
  7.          public static void SetSubmitButton(DependencyObject obj, object value)
  8.          {
  9.              obj.SetValue(SubmitButtonProperty, value);
  10.          }
  11.  
  12.          // Using a DependencyProperty as the backing store for SubmitButton.  This enables animation, styling, binding, etc...
  13.          public static readonly DependencyProperty SubmitButtonProperty =
  14.              DependencyProperty.RegisterAttached("SubmitButton", typeof(object), typeof(AttachProperties), new PropertyMetadata(SubmitButtonChanged));
  15.  
  16.          private static void SubmitButtonChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  17.          {
  18.              var button = (ButtonBase)e.NewValue;
  19.              var form = d as UIElement;
  20.              form.KeyDown += (s, se) =>
  21.              {
  22.                  if (se.Key == Key.Enter)
  23.                  {
  24.                      button.Focus();
  25.                      if (button.Command != null)
  26.                         button.Dispatcher.BeginInvoke(()=>  button.Command.Execute(null));
  27.                  }
  28.              };
  29.          }
  30.          #endregion

分享標(biāo)題:Silverlight快速開(kāi)發(fā)框架RapidSL新特性
鏈接分享:http://m.5511xx.com/article/cdhjisp.html