private void setSearchProvider() { var thread = new Thread(() => { // this sometimes takes a while Type provider = typeof(SearchHelper); Application.Current.Dispatcher.BeginInvoke(new Action(() => { ObjectDataProvider vistaSearchProvider = new ObjectDataProvider(); vistaSearchProvider.ObjectType = provider; CairoSearchMenu.DataContext = vistaSearchProvider; Binding bSearchText = new Binding("SearchText"); bSearchText.Mode = BindingMode.Default; bSearchText.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; Binding bSearchResults = new Binding("Results"); bSearchResults.Mode = BindingMode.Default; bSearchResults.IsAsync = true; searchStr.SetBinding(TextBox.TextProperty, bSearchText); lstSearchResults.SetBinding(ListView.ItemsSourceProperty, bSearchResults); })); }); thread.IsBackground = true; thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
private void SetBinding() { //创建并配置ObjectDataProvider对象 ObjectDataProvider odp = new ObjectDataProvider(); odp.ObjectInstance = new Calculator(); odp.MethodName = "Add"; odp.MethodParameters.Add("10"); odp.MethodParameters.Add("10"); //以ObjectDataProvider对象为Source创建Binding Binding bindingToStr1 = new Binding("MethodParameters[0]") { Source = odp, BindsDirectlyToSource = true, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding bindingToStr2 = new Binding("MethodParameters[1]") { Source = odp, BindsDirectlyToSource = true, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding bindingToResult = new Binding(".") { Source = odp }; //将Binding关联到UI元素上 this.TextBoxStr1.SetBinding(TextBox.TextProperty, bindingToStr1); this.TextBoxStr2.SetBinding(TextBox.TextProperty, bindingToStr2); this.TextBoxResult.SetBinding(TextBox.TextProperty, bindingToResult); }
private void SetBinding() { ObjectDataProvider objpro = new ObjectDataProvider(); objpro.ObjectInstance = new Caculate(); objpro.MethodName = "Add"; objpro.MethodParameters.Add("0"); objpro.MethodParameters.Add("0"); Binding bindingToArg1 = new Binding("MethodParameters[0]") { Source = objpro, BindsDirectlyToSource = true, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding bindingToArg2 = new Binding("MethodParameters[1]") { Source = objpro, BindsDirectlyToSource = true, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding bindToResult = new Binding(".") { Source = objpro }; this.arg1.SetBinding(TextBox.TextProperty, bindingToArg1); this.arg2.SetBinding(TextBox.TextProperty, bindingToArg2); this.result.SetBinding(TextBox.TextProperty, bindToResult); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _isLoading = true; RoomListBox.ItemsSource = _repo.RoomsListInMemory(); _roomsViewSource = (ObjectDataProvider)FindResource("roomViewSource"); _isLoading = false; RoomListBox.SelectedIndex = 0; }
private void Window_Loaded(object sender, RoutedEventArgs e) { _isLoading = true; clientRoomDataGrid.ItemsSource = _repo.ClientRoomListInMemory(); _clientRoomViewSource = (ObjectDataProvider)FindResource("clientRoomViewSource"); _isLoading = false; clientRoomDataGrid.SelectedIndex = 0; }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.isLoading = true; samuraiListBox.ItemsSource = data.SamuraisListInMemory(); this.samuraiViewSource = (ObjectDataProvider)FindResource(config.samuraiViewSource); this.isLoading = false; samuraiListBox.SelectedIndex = 0; }
public RootQueryType(IAsyncBatch batch, RoscoeDb db) { this.batch = batch; this.db = db; provider = batch.Add(new RoscoeAsyncOperation <RoscoeDb>(db)); enumProvider = batch.Add(new ObjectDataProvider <OrgType>(token => Task.FromResult(OrgType.Sme))); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _isLoading = true; clientListBox.ItemsSource = _repo.ClientsListInMemory(); _clientViewSource = (ObjectDataProvider)FindResource("clientViewSource"); _isLoading = false; clientListBox.SelectedIndex = 0; }
/// <summary> /// <para>Basic Constructor for Culmulative Count</para> /// <para>Gets the current researcher controller</para> /// </summary> public CumulativeCountView() { InitializeComponent(); //get researcher and controller instance ObjectDataProvider researcherlist = (ObjectDataProvider)FindResource("researcherlist"); researcherController = (Controller.ResearcherController)researcherlist.ObjectInstance; }
private void Window_Loaded(object sender, RoutedEventArgs e) { ObjectDataProvider odp = (ObjectDataProvider)this.Resources["List_User"]; usuarios = odp.Data as ObservableCollection <ClasesBase.Clases.Usuario>; vista = (CollectionView)CollectionViewSource.GetDefaultView(canvas_content.DataContext); }
/// <summary> /// Searchbox event handler, Search videos by user specifed input /// </summary> private void OnKeyUp(object sender, KeyEventArgs e) { if (e.Key.Equals(Key.Enter)) { ObjectDataProvider objectDataProvider = Resources["MsnVideosList"] as ObjectDataProvider; objectDataProvider.MethodParameters[0] = @"http://blogs.msdn.com/b/ericlippert/rss.aspx?searchTerm=" + searchBox.Text; objectDataProvider.Refresh(); } }
/// <summary> /// Gets wszystkie dostępne zasoby /// </summary> /// <returns>Zasób jako ObjectDataProvider</returns> public static ObjectDataProvider GetResourceProvider() { if (_provider == null) { _provider = (ObjectDataProvider)App.Current.FindResource("Resources"); } return(_provider); }
private void BtnTest_OnClick(object sender, RoutedEventArgs e) { ObjectDataProvider odp=new ObjectDataProvider(); odp.ObjectInstance = new Calculator(); odp.MethodName = "Add"; odp.MethodParameters.Add("100"); odp.MethodParameters.Add("200"); MessageBox.Show(odp.Data.ToString()); }
static void Main(string[] args) { ObjectDataProvider pay = new ObjectDataProvider(); pay.ObjectType = typeof(Process); pay.MethodParameters.Add("cmd.exe"); pay.MethodParameters.Add("/c calc.exe"); pay.MethodName = "Start"; }
/// <summary> /// Initializes a new instance of the OptionsDialog class. /// </summary> /// <param name="options"></param> public OptionsDialog(RegexDesignerScreenData data) : this() { _Options = data.ApplicationOptions; mainGrid.DataContext = _Options; ObjectDataProvider layoutProvider = (ObjectDataProvider)this.FindResource("layoutOptionsDataProvider"); layoutProvider.ObjectInstance = data.LayoutOptions; }
public LoginView() { InitializeComponent(); App app = (App)System.Windows.Application.Current; ObjectDataProvider odp = (ObjectDataProvider)app.Resources["ChatModel"]; _model = (ChatModel)odp.Data; _coordinator = app.getCoordinator(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ObjectDataProvider odp = (ObjectDataProvider)this.Resources["LISTA_ARTICULOS"]; listaArt = odp.Data as ObservableCollection <Articulo>; view = (CollectionView)CollectionViewSource.GetDefaultView(canvas_container.DataContext); sldNavegador.Maximum = view.Count - 1; }
/* * <ObjectDataProvider x:Key="Resources" ObjectType="{x:Type resource:CultureResources}" MethodName="GetResourceInstance" /> */ private static ObjectDataProvider BuildObjectDataProvider() { LocaleResourceFactory locale = new LocaleResourceFactory(); _objectDataProvider = new ObjectDataProvider(); _objectDataProvider.ObjectType = locale.GetType(); _objectDataProvider.MethodName = "GetResourceLanguage"; _objectDataProvider.ObjectInstance = locale; return(_objectDataProvider); }
public void SetPoints(List <Vector> points) { mainGrid.DataContext = null; PointsDataProvider.UpdatePoints(points); ObjectDataProvider o = new ObjectDataProvider(); o.ObjectInstance = PointsDataProvider; o.MethodName = "GetPoints"; mainGrid.DataContext = o; }
// UI Event handler for btnEven void btnEven(object sender, RoutedEventArgs e) { // Get the NumberList by finding its Data Source Object. FrameworkElement fe = (FrameworkElement)sender; ObjectDataProvider odp = (ObjectDataProvider)fe.FindResource("NumberListDSO"); NumberList nl = (NumberList)odp.Data; // Tell the NumberList to set itself to even values. nl.SetEven(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _isLoading = true; ninjaListBox.ItemsSource = _repo.NinjasInMemory(); SortNinjaList(); clanComboBox.ItemsSource = _repo.GetClanList(); _ninjaViewSource = ((ObjectDataProvider)(FindResource("ninjaViewSource"))); ninjaListBox.SelectedIndex = 0; _isLoading = false; }
private void Btn_add_Click(object sender, RoutedEventArgs e) { ObjectDataProvider odp = new ObjectDataProvider(); odp.ObjectInstance = new Calculator(); odp.MethodName = "Add"; odp.MethodParameters.Add("100"); odp.MethodParameters.Add("200"); msg(odp.Data); }
public LinesGridControl() { InitializeComponent(); DataSource = new LinesDataSource(); ObjectDataProvider o = new ObjectDataProvider(); o.ObjectInstance = DataSource; o.MethodName = "GetLines"; mainGrid.DataContext = o; }
/// <summary> /// Handles visibility changing of framework elements. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private static void frameworkElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { FrameworkElement elem = sender as FrameworkElement; if (elem.IsVisible) { ObjectDataProvider provider = ((sender as FrameworkElement).Resources["Resources"] as ObjectDataProvider); provider.Refresh(); CultureResources.registerDataProvider(provider); } }
/// <summary> /// Gets an ODP to use for registering for language changing. /// </summary> /// <returns>The ODP.</returns> public static ObjectDataProvider getDataProvider() { if (odp == null) { odp = new ObjectDataProvider(); odp.ObjectType = typeof(CultureResources); odp.MethodName = "GetResourceInstance"; registerDataProvider(odp); } return(odp); }
public PointGridDisplayControl() { InitializeComponent(); PointsDataProvider = new PointsDataSource(); ObjectDataProvider o = new ObjectDataProvider(); o.ObjectInstance = PointsDataProvider; o.MethodName = "GetPoints"; mainGrid.DataContext = o; }
/// <summary> /// Gets an ODP to use for registering for language changing. /// </summary> /// <returns>The ODP.</returns> public static ObjectDataProvider getDataProvider() { if (odp == null) { odp = new ObjectDataProvider(); odp.ObjectType = (new CultureResources()).GetType(); odp.MethodName = "GetResourceInstance"; L3.Cargo.Common.Dashboard.CultureResources.registerDataProvider(odp); } return(odp); }
/// <summary> /// <para>Basic constructor for ResearcherListView</para> /// <para>Gets current controller instance</para> /// </summary> public ResearcherListView() { InitializeComponent(); //get researcher and controller instance ObjectDataProvider researcherlist = (ObjectDataProvider)FindResource("researcherlist"); controller = (Controller.ResearcherController)researcherlist.ObjectInstance; //ListBox initialisation ResearcherListView_DisplayBox.SelectionMode = SelectionMode.Single; }
private void Button_Click(object sender, RoutedEventArgs e) { //用来包装一个以方法暴露数据的对象 ObjectDataProvider odp = new ObjectDataProvider(); odp.ObjectInstance = new Calculator(); odp.MethodName = "AddNum"; odp.MethodParameters.Add("100"); odp.MethodParameters.Add("200"); odp.MethodParameters.Add("223"); MessageBox.Show(odp.Data.ToString()); }
public MainWindow() { InitializeComponent(); rel(); ObjectDataProvider o = Resources["dados"] as ObjectDataProvider; dados = o.Data as Dados; viewmodel = (ViewModel)Resources["vm"]; viewmodel.dados = dados; }