I started to program with monodevelop (gtk#).
I have a very simple question:
protected void OnButton1Clicked (object sender, EventArgs e)
{
textview1.Buffer.Text="hallooo";
}
I just want the textview widget to show the text above. But when I run the program nothing happens.
You need more code?
Related
I am trying to create an event on page save, I have followed step by step documentation and created a class in App_Code folder, I can build without any error but event is not triggering.
here is my code
using CMS;
using CMS.DataEngine;
using CMS.DocumentEngine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
[assembly: RegisterModule(typeof(ElectionEventHandler))]
public class ElectionEventHandler : Module
{
public ElectionEventHandler()
: base("CustomInithahaah")
{
}
protected override void OnInit()
{
base.OnInit();
// Assigns custom handlers to events
DocumentEvents.Update.After += Update_After;
DocumentEvents.Insert.After += Insert_After;
ObjectEvents.Insert.After += Insert_After1;
ObjectEvents.Update.After += Update_After1;
}
private void Update_After1(object sender, ObjectEventArgs e)
{
throw new NotImplementedException();
}
private void Insert_After1(object sender, ObjectEventArgs e)
{
throw new NotImplementedException();
}
private void Insert_After(object sender, DocumentEventArgs e)
{
}
private void Update_After(object sender, DocumentEventArgs e)
{
}
}
here is the location of my class in project.
In Pages module, I have created some pages and on the form tab of the page I am updating some values and expect these events to trigger but nothing is happening.
You're using a web app vs. a web site so technically there is no App_Code directory. I believe all you need to do is build the project and your event should fire.
With a web app, you need to build each time you view the site. With a web site, it will run the JIT compiler and compile that code automatically in the App_Code directory.
I'm having difficulty finding how to register a RoutedEventHandler in UWP. I'm attempting to code a template control that has event properties similar to ContentDialog's:
PrimaryButtonClick="ClickEvent"
Where ClickEvent is defined in the cs file. I'm only just getting the hang of templates, but I believe I want to do something that looks like this:
<Button Content="{TemplateBinding PrimaryButtonText}" Click="{TemplateBinding PrimaryButtonClick}"/>
Currently, all I can find is references to WPF versions of this type of code:
public static readonly RoutedEvent ValueChangedEvent =
EventManager.RegisterRoutedEvent("ValueChanged",
RoutingStrategy.Direct, typeof(RoutedPropertyChangedEventHandler<double>),
typeof(NumericBox));
public event RoutedPropertyChangedEventHandler<double> ValueChanged
{
add { AddHandler(ValueChangedEvent, value); }
remove { RemoveHandler(ValueChangedEvent, value); }
}
private void OnValueChanged(double oldValue, double newValue)
{
RoutedPropertyChangedEventArgs<double> args =
new RoutedPropertyChangedEventArgs<double>(oldValue, newValue);
args.RoutedEvent = NumericBox.ValueChangedEvent;
RaiseEvent(args);
}
But of course the types have changed. Can someone point me in the right direction?
Unfortunately, the concept of RoutedEvent (bubbling, tunneling) is not available in UWP currently. You can just create a classic event however instead:
public event EventHandler PrimaryButtonClick;
protected void InnerButton_Click(object sender, EventArgs e)
{
PrimaryButtonClick?.Invoke( sender, e );
}
Bubbling of events is possible for some predefined events, but it is not yet possible to allow bubbling for custom events in current version of UWP.
I trying to navigate between XAML pages in grid app. for this i have added a added a new XAML and a button in XAML and cs code for button event is
private void OnClick(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof (GroupedItemsPage));
}
on clicking this button my app should navigate to GroupedItemsPage, but instead it raises an null exception
try this :
private void OnClick(object sender, RoutedEventArgs e)
{
this.Frame.Navigate(typeof (GroupedItemsPage));
}
Please have a look there, too.
I am using Silverlight 4 with WCF Services for my database interaction . I am facing one problem.
Function all in silverlight application.
ServiceReference1.WCFSLServicesClient wc = new ServiceReference1.WCFSLServicesClient();
private void button1_Click(object sender, RoutedEventArgs e)
{
_wait = new ManualResetEvent(false);
wc.SayHelloCompleted += new EventHandler<ServiceReference1.SayHelloCompletedEventArgs>(wc_SayHelloCompleted);
wc.SayHelloAsync("Mr. X");
//wait untill the call finish and then move next like
//Here I want to do some thing with result of above call. And then proceed to next task .
}
String Name = String.Empty;
void wc_SayHelloCompleted(object sender, ServiceReference1.SayHelloCompletedEventArgs e)
{
Name =e.Result;
}
But all methods calls in Silver light are Async so I am not able to Get this out.
Put whatever it is you want to do into another method and call that method from your Completed Handler.
void wc_SayHelloCompleted(object sender, ServiceReference1.SayHelloCompletedEventArgs e)
{
Name =e.Result;
MyNewMethod(Name);
}
Is it possible to edit data in a SilverLight Child window when using RIA Services and Silverlight 4? It sounds like a simple enough question, but I have not been able to get any combination of scenarios to work.
Simply put, I am viewing data in a grid that was populated through a DomainDataSource. Instead of editing the data on the same screen (this is the pattern that ALL of the Microsoft samples seem to use), I want to open a child window, edit the data and return. Surely this is a common design pattern.
If anyone knows of a sample out there that uses this pattern, a link would be much appreciated.
Thanks,
Rick Arthur
This is a Microsoft sample that uses a ChildWindow. It uses RIA services, but not MVVM.
It doesn't fix a problem I'm having where entities get attached to my context before I want them to be, but does what you're looking for other than that.
Here's the relevant code to save you downloading the zip:
private void addNewEmployee_Click(object sender, RoutedEventArgs e)
{
EmployeeRegistrationWindow addEmp = new EmployeeRegistrationWindow();
addEmp.Closed += new EventHandler(addEmp_Closed);
addEmp.Show();
}
public partial class EmployeeRegistrationWindow : ChildWindow
{
public EmployeeRegistrationWindow()
{
InitializeComponent();
NewEmployee = new Employee();
addEmployeeDataForm.CurrentItem = NewEmployee;
addEmployeeDataForm.BeginEdit();
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
addEmployeeDataForm.CommitEdit();
this.DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
NewEmployee = null;
addEmployeeDataForm.CancelEdit();
this.DialogResult = false;
}
public Employee NewEmployee { get; set; }
}
The MVVM light Toolkit found here has messeging between viewmodels for more information check above site. Please write if u need an example.