Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 30/174 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • How to make tooltip move with mouse (winforms)

    - by BlueRaja The Green Unicorn
    I want it to move when the mouse moves, and disappear when the pointer isn't over the label. This doesn't work: private void lblRevisionQuestion_MouseMove(object sender, MouseEventArgs e) { toolTip1.Show("test", this, PointToClient(MousePosition), Int32.MaxValue); } private void lblRevisionQuestion_MouseLeave(object sender, EventArgs e) { toolTip1.Hide(this); } As soon as the tooltip appears, it steals focus away from the form, evoking MouseLeave. Then the tooltip hides, and the pointer is once again over the label, invoking MouseMove. This results in a choppy, flashing tooltip. Is there any way to do this?

    Read the article

  • how to change a button into a imagebutton in asp.net c#

    - by sweetsecret
    How to change the button into image button... the button in the beginning has "Pick a date" when clicked a calender pops out and the when a date is selected a label at the bottom reading the date comes in and the text on the button changes to disabled... i want to palce a imagebutton having a image icon of the calender and rest of the function will be the same.... the code as follows: using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [assembly: TagPrefix("DatePicker", "EWS")] namespace EclipseWebSolutions.DatePicker { [DefaultProperty("Text")] [ToolboxData("<{0}:DatePicker runat=server")] [DefaultEvent("SelectionChanged")] [ValidationProperty("TextValue")] public class DatePicker : WebControl, INamingContainer { #region Properties public TextBox txtDate = new TextBox(); public Calendar calDate = new Calendar(); public Button btnDate = new Button(); public Panel pnlCalendar = new Panel(); private enum ViewStateConstants { ValidationGroup, RegularExpression, ErrorMessage, RegExText, CalendarPosition, FormatString, ExpandLabel, CollapseLabel, ApplyDefaultStyle, CausesValidation, } /// <summary> /// Defines the available display modes of this calendar. /// </summary> public enum CalendarDisplay { DisplayRight, DisplayBelow } /// <summary> /// Where to display the popup calendar. /// </summary> [Category("Behaviour")] [Localizable(true)] public CalendarDisplay CalendarPosition { get { if (ViewState[ViewStateConstants.CalendarPosition.ToString()] == null) { ViewState[ViewStateConstants.CalendarPosition.ToString()] = CalendarDisplay.DisplayRight; } return (CalendarDisplay)ViewState[ViewStateConstants.CalendarPosition.ToString()]; } set { ViewState[ViewStateConstants.CalendarPosition.ToString()] = value; } } /// <summary> /// Text version of the control's value, for use by ASP.NET validators. /// </summary> public string TextValue { get { return txtDate.Text; } } /// <summary> /// Holds the current date value of this control. /// </summary> [Category("Behaviour")] [Localizable(true)] [Bindable(true, BindingDirection.TwoWay)] public DateTime DateValue { get { try { if (txtDate.Text == "") return DateTime.MinValue; DateTime val = DateTime.Parse(txtDate.Text); return val; } catch (ArgumentNullException) { return DateTime.MinValue; } catch (FormatException) { return DateTime.MinValue; } } set { if (value == DateTime.MinValue) { txtDate.Text = ""; } else { txtDate.Text = value.ToShortDateString(); } } } [Category("Behavior"), Themeable(false), DefaultValue("")] public virtual string ValidationGroup { get { if (ViewState[ViewStateConstants.ValidationGroup.ToString()] == null) { return string.Empty; } else { return (string)ViewState[ViewStateConstants.ValidationGroup.ToString()]; } } set { ViewState[ViewStateConstants.ValidationGroup.ToString()] = value; } } /// <summary> /// The label of the exand button. Shown when the calendar is hidden. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("PickDate")] [Localizable(true)] public string ExpandButtonLabel { get { String s = (String)ViewState[ViewStateConstants.ExpandLabel.ToString()]; return ((s == null) ? "PickDate" : s); } set { ViewState[ViewStateConstants.ExpandLabel.ToString()] = value; } } /// <summary> /// The label of the collapse button. Shown when the calendar is visible. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("Disabled")] [Localizable(true)] public string CollapseButtonLabel { get { String s = (String)ViewState[ViewStateConstants.CollapseLabel.ToString()]; return ((s == null) ? "Disabled" : s); } set { ViewState[ViewStateConstants.CollapseLabel.ToString()] = value; } } /// <summary> /// Whether to apply the default style. Disable this if you want to apply a custom style, or to use themes and skins /// to style the control. /// </summary> [Category("Appearance")] [DefaultValue(true)] [Localizable(true)] public bool ApplyDefaultStyle { get { if (ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] == null) { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = true; } return (bool)ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()]; } set { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = value; } } /// <summary> /// Causes Validation /// </summary> [Category("Appearance")] [DefaultValue(false)] [Localizable(false)] public bool CausesValidation { get { if (ViewState[ViewStateConstants.CausesValidation.ToString()] == null) { ViewState[ViewStateConstants.CausesValidation.ToString()] = false; } return (bool)ViewState[ViewStateConstants.CausesValidation.ToString()]; } set { ViewState[ViewStateConstants.CausesValidation.ToString()] = value; btnDate.CausesValidation = value; } } #endregion #region Events /// <summary> /// A day was selected from the calendar control. /// </summary> public event EventHandler SelectionChanged; protected virtual void OnSelectionChanged() { if (SelectionChanged != null) // only raise the event if someone is listening. { SelectionChanged(this, EventArgs.Empty); } } #endregion #region Event Handlers /// <summary> /// The +/- button was clicked. /// </summary> protected void btnDate_Click(object sender, System.EventArgs e) { if (!calDate.Visible) { // expand the calendar calDate.Visible = true; txtDate.Enabled = false; btnDate.Text = CollapseButtonLabel; if (DateValue != DateTime.MinValue) { calDate.SelectedDate = DateValue; calDate.VisibleDate = DateValue; } } else { // collapse the calendar calDate.Visible = false; txtDate.Enabled = true; btnDate.Text = ExpandButtonLabel; } } /// <summary> /// A date was selected from the calendar. /// </summary> protected void calDate_SelectionChanged(object sender, System.EventArgs e) { calDate.Visible = false; txtDate.Visible = true; btnDate.Text = ExpandButtonLabel; txtDate.Enabled = true; txtDate.Text = calDate.SelectedDate.ToShortDateString(); OnSelectionChanged(); } #endregion /// <summary> /// Builds the contents of this control. /// </summary> protected override void CreateChildControls() { btnDate.Text = ExpandButtonLabel; btnDate.CausesValidation = CausesValidation; txtDate.ID = "txtDate"; calDate.Visible = false; if (ApplyDefaultStyle) { calDate.BackColor = System.Drawing.Color.White; calDate.BorderColor = System.Drawing.Color.FromArgb(10066329); calDate.CellPadding = 2; calDate.DayNameFormat = DayNameFormat.Shortest; calDate.Font.Name = "Verdana"; calDate.Font.Size = FontUnit.Parse("8pt"); calDate.ForeColor = System.Drawing.Color.Black; calDate.Height = new Unit(150, UnitType.Pixel); calDate.Width = new Unit(180, UnitType.Pixel); calDate.DayHeaderStyle.BackColor = System.Drawing.Color.FromArgb(228, 228, 228); calDate.DayHeaderStyle.Font.Size = FontUnit.Parse("7pt"); calDate.TitleStyle.Font.Bold = true; calDate.WeekendDayStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 204); } ConnectEventHandlers(); pnlCalendar.Controls.Add(calDate); pnlCalendar.Style["position"] = "absolute"; pnlCalendar.Style["filter"] = "alpha(opacity=95)"; pnlCalendar.Style["-moz-opacity"] = ".95"; pnlCalendar.Style["opacity"] = ".95"; pnlCalendar.Style["z-index"] = "2"; pnlCalendar.Style["background-color"] = "White"; if (CalendarPosition == CalendarDisplay.DisplayBelow) { pnlCalendar.Style["margin-top"] = "27px"; } else { pnlCalendar.Style["display"] = "inline"; } Controls.Add(txtDate); Controls.Add(pnlCalendar); Controls.Add(btnDate); base.CreateChildControls(); } /// <summary> /// Render the contents of this control. /// </summary> /// <param name="output">The HtmlTextWriter to use.</param> protected override void RenderContents(HtmlTextWriter output) { switch (CalendarPosition) { case CalendarDisplay.DisplayRight: { txtDate.RenderControl(output); btnDate.RenderControl(output); pnlCalendar.RenderControl(output); break; } case CalendarDisplay.DisplayBelow: { pnlCalendar.RenderControl(output); txtDate.RenderControl(output); btnDate.RenderControl(output); break; } } } /// <summary> /// Connect event handlers to events. /// </summary> private void ConnectEventHandlers() { btnDate.Click += new System.EventHandler(btnDate_Click); calDate.SelectionChanged += new System.EventHandler(calDate_SelectionChanged); } } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [assembly: TagPrefix("DatePicker", "EWS")] namespace EclipseWebSolutions.DatePicker { [DefaultProperty("Text")] [ToolboxData("<{0}:DatePicker runat=server")] [DefaultEvent("SelectionChanged")] [ValidationProperty("TextValue")] public class DatePicker : WebControl, INamingContainer { #region Properties public TextBox txtDate = new TextBox(); public Calendar calDate = new Calendar(); public Button btnDate = new Button(); public Panel pnlCalendar = new Panel(); private enum ViewStateConstants { ValidationGroup, RegularExpression, ErrorMessage, RegExText, CalendarPosition, FormatString, ExpandLabel, CollapseLabel, ApplyDefaultStyle, CausesValidation, } /// <summary> /// Defines the available display modes of this calendar. /// </summary> public enum CalendarDisplay { DisplayRight, DisplayBelow } /// <summary> /// Where to display the popup calendar. /// </summary> [Category("Behaviour")] [Localizable(true)] public CalendarDisplay CalendarPosition { get { if (ViewState[ViewStateConstants.CalendarPosition.ToString()] == null) { ViewState[ViewStateConstants.CalendarPosition.ToString()] = CalendarDisplay.DisplayRight; } return (CalendarDisplay)ViewState[ViewStateConstants.CalendarPosition.ToString()]; } set { ViewState[ViewStateConstants.CalendarPosition.ToString()] = value; } } /// <summary> /// Text version of the control's value, for use by ASP.NET validators. /// </summary> public string TextValue { get { return txtDate.Text; } } /// <summary> /// Holds the current date value of this control. /// </summary> [Category("Behaviour")] [Localizable(true)] [Bindable(true, BindingDirection.TwoWay)] public DateTime DateValue { get { try { if (txtDate.Text == "") return DateTime.MinValue; DateTime val = DateTime.Parse(txtDate.Text); return val; } catch (ArgumentNullException) { return DateTime.MinValue; } catch (FormatException) { return DateTime.MinValue; } } set { if (value == DateTime.MinValue) { txtDate.Text = ""; } else { txtDate.Text = value.ToShortDateString(); } } } [Category("Behavior"), Themeable(false), DefaultValue("")] public virtual string ValidationGroup { get { if (ViewState[ViewStateConstants.ValidationGroup.ToString()] == null) { return string.Empty; } else { return (string)ViewState[ViewStateConstants.ValidationGroup.ToString()]; } } set { ViewState[ViewStateConstants.ValidationGroup.ToString()] = value; } } /// <summary> /// The label of the exand button. Shown when the calendar is hidden. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("PickDate")] [Localizable(true)] public string ExpandButtonLabel { get { String s = (String)ViewState[ViewStateConstants.ExpandLabel.ToString()]; return ((s == null) ? "PickDate" : s); } set { ViewState[ViewStateConstants.ExpandLabel.ToString()] = value; } } /// <summary> /// The label of the collapse button. Shown when the calendar is visible. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("Disabled")] [Localizable(true)] public string CollapseButtonLabel { get { String s = (String)ViewState[ViewStateConstants.CollapseLabel.ToString()]; return ((s == null) ? "Disabled" : s); } set { ViewState[ViewStateConstants.CollapseLabel.ToString()] = value; } } /// <summary> /// Whether to apply the default style. Disable this if you want to apply a custom style, or to use themes and skins /// to style the control. /// </summary> [Category("Appearance")] [DefaultValue(true)] [Localizable(true)] public bool ApplyDefaultStyle { get { if (ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] == null) { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = true; } return (bool)ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()]; } set { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = value; } } /// <summary> /// Causes Validation /// </summary> [Category("Appearance")] [DefaultValue(false)] [Localizable(false)] public bool CausesValidation { get { if (ViewState[ViewStateConstants.CausesValidation.ToString()] == null) { ViewState[ViewStateConstants.CausesValidation.ToString()] = false; } return (bool)ViewState[ViewStateConstants.CausesValidation.ToString()]; } set { ViewState[ViewStateConstants.CausesValidation.ToString()] = value; btnDate.CausesValidation = value; } } #endregion #region Events /// <summary> /// A day was selected from the calendar control. /// </summary> public event EventHandler SelectionChanged; protected virtual void OnSelectionChanged() { if (SelectionChanged != null) // only raise the event if someone is listening. { SelectionChanged(this, EventArgs.Empty); } } #endregion #region Event Handlers /// <summary> /// The +/- button was clicked. /// </summary> protected void btnDate_Click(object sender, System.EventArgs e) { if (!calDate.Visible) { // expand the calendar calDate.Visible = true; txtDate.Enabled = false; btnDate.Text = CollapseButtonLabel; if (DateValue != DateTime.MinValue) { calDate.SelectedDate = DateValue; calDate.VisibleDate = DateValue; } } else { // collapse the calendar calDate.Visible = false; txtDate.Enabled = true; btnDate.Text = ExpandButtonLabel; } } /// <summary> /// A date was selected from the calendar. /// </summary> protected void calDate_SelectionChanged(object sender, System.EventArgs e) { calDate.Visible = false; txtDate.Visible = true; btnDate.Text = ExpandButtonLabel; txtDate.Enabled = true; txtDate.Text = calDate.SelectedDate.ToShortDateString(); OnSelectionChanged(); } #endregion /// <summary> /// Builds the contents of this control. /// </summary> protected override void CreateChildControls() { btnDate.Text = ExpandButtonLabel; btnDate.CausesValidation = CausesValidation; txtDate.ID = "txtDate"; calDate.Visible = false; if (ApplyDefaultStyle) { calDate.BackColor = System.Drawing.Color.White; calDate.BorderColor = System.Drawing.Color.FromArgb(10066329); calDate.CellPadding = 2; calDate.DayNameFormat = DayNameFormat.Shortest; calDate.Font.Name = "Verdana"; calDate.Font.Size = FontUnit.Parse("8pt"); calDate.ForeColor = System.Drawing.Color.Black; calDate.Height = new Unit(150, UnitType.Pixel); calDate.Width = new Unit(180, UnitType.Pixel); calDate.DayHeaderStyle.BackColor = System.Drawing.Color.FromArgb(228, 228, 228); calDate.DayHeaderStyle.Font.Size = FontUnit.Parse("7pt"); calDate.TitleStyle.Font.Bold = true; calDate.WeekendDayStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 204); } ConnectEventHandlers(); pnlCalendar.Controls.Add(calDate); pnlCalendar.Style["position"] = "absolute"; pnlCalendar.Style["filter"] = "alpha(opacity=95)"; pnlCalendar.Style["-moz-opacity"] = ".95"; pnlCalendar.Style["opacity"] = ".95"; pnlCalendar.Style["z-index"] = "2"; pnlCalendar.Style["background-color"] = "White"; if (CalendarPosition == CalendarDisplay.DisplayBelow) { pnlCalendar.Style["margin-top"] = "27px"; } else { pnlCalendar.Style["display"] = "inline"; } Controls.Add(txtDate); Controls.Add(pnlCalendar); Controls.Add(btnDate); base.CreateChildControls(); } /// <summary> /// Render the contents of this control. /// </summary> /// <param name="output">The HtmlTextWriter to use.</param> protected override void RenderContents(HtmlTextWriter output) { switch (CalendarPosition) { case CalendarDisplay.DisplayRight: { txtDate.RenderControl(output); btnDate.RenderControl(output); pnlCalendar.RenderControl(output); break; } case CalendarDisplay.DisplayBelow: { pnlCalendar.RenderControl(output); txtDate.RenderControl(output); btnDate.RenderControl(output); break; } } } /// <summary> /// Connect event handlers to events. /// </summary> private void ConnectEventHandlers() { btnDate.Click += new System.EventHandler(btnDate_Click); calDate.SelectionChanged += new System.EventHandler(calDate_SelectionChanged); } } } <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" % <%@ Register Assembly="EclipseWebSolutions.DatePicker" Namespace="EclipseWebSolutions.DatePicker" TagPrefix="ews" % Untitled Page       using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void DatePicker1_SelectionChanged(object sender, EventArgs e) { Label1.Text = DatePicker1.DateValue.ToShortDateString(); pnlLabel.Update(); } }

    Read the article

  • Passing events in JMS

    - by sam
    I'm new in JMS. In my program, My Problem is that , I want to pass 4 events(classes) (callEvent, agentEvent, featureEvent, eventListenerExit) from the JMSQueue Program , who i m mention below. How can I do this? // (JmsSender.java) package com.apac.control.helper; import java.util.Calendar; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; import com.apac.control.api.CallData; import com.apac.control.exception.CtiException; import library.cti.CtiEventDocument; import library.cti.impl.CtiEventDocumentImpl; public final class JmsSender { private QueueConnectionFactory factory; private Queue queue; private QueueConnection connection; private QueueSession session; private QueueSender sender; private String sessionId; private String deviceId; private String centerId; private String switchId; public JmsSender(String queueJndiName, String sessionId, String deviceId, String centerId, String switchId) throws CtiException { this.sessionId = sessionId; this.deviceId = deviceId; this.centerId = centerId; this.switchId = switchId; try { InitialContext ic = new InitialContext(); factory = (QueueConnectionFactory) ic.lookup("javax/jms/QueueConnectionFactory"); queue = (Queue) ic.lookup(queueJndiName); } catch (Exception e) { throw new CtiException("CTI. Error creating JmsSender.", e); } } public String getCenterId() { return centerId; } public String getDeviceId() { return deviceId; } public String getSwitchId() { return switchId; } public void connect() throws CtiException { try { connection = factory.createQueueConnection(); } catch (Exception e) { throw new CtiException("CTI000. Error connecting to cti queue."); } } public void close() throws CtiException { try { connection.close(); } catch (Exception e) { throw new CtiException("CTI000. Error closing queue."); } } public void send(String eventType, CallData call, long seqId) throws CtiException { // prepare the message CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setSequenceId(seqId); ce.setCallId("" + call.getCallId()); ce.setUcid(call.getUCID()); ce.setEventType(eventType); ce.setDnisNumber(call.getDnisNumber()); ce.setAniNumber(call.getAniNumber()); ce.setApplicationData(call.getApplicationData()); ce.setQueueNumber(call.getQueueNumber()); ce.setCallingNumber(call.getCallingNumber()); if (call instanceof ManualCall) { ce.setManual("yes"); } try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } public void send(String eventType, String agentId, String agentMode, long seqId) throws CtiException { CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setSequenceId(seqId); ce.setEventType(eventType); ce.setAgentId(agentId); ce.setAgentMode(agentMode); try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } public void sendError(String errCode, String errMsg) throws CtiException { CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setEventType("Error"); ce.setErrorCode(errCode); ce.setErrorMessage(errMsg); try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } private CtiEventDocument createBaseCtiDocument() { CtiEventDocument ced = CtiEventDocument.Factory.newInstance(); CtiEventDocument ce = ced.addNewCtiEvent(); ce.setSessionId(sessionId); ce.setSwitchId(switchId); ce.setCenterId(centerId); ce.setDeviceId(deviceId); ce.setTime(Calendar.getInstance()); return ced; } // Synchronization protects session, which cannot be // accessed by more than one thread. We may more than // one thread here from Cti in some cases (for example // when customer is being transfered out and hangs the call // at the same time. synchronized void sendMessage(String msg) throws Exception { session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE); sender = session.createSender(queue); TextMessage txtMsg = session.createTextMessage(msg); sender.send(txtMsg); sender.close(); session.commit(); } }

    Read the article

  • e.DetailsElement in silverlight

    - by prince23
    hi, is there any way i can write this code in a function() right now what is happening in function is it tells e.Row.DetailsVisibility e.DetailsElement.ActualHeight it is not able to find this it is telling is there any way i can get this e.DetailsElement.ActualHeight if (e.Row.DetailsVisibility == Visibility.Visible) { Dispatcher.BeginInvoke(() => { DataGrid datagrid = sender as DataGrid; if (datagrid != null) { datagrid.Tag = e.DetailsElement.ActualHeight; datagrid.Height = datagrid.ActualHeight + e.DetailsElement.ActualHeight; } } ); } else { DataGrid datagrid = sender as DataGrid; if(datagrid.Tag!=null) datagrid.Height = datagrid.ActualHeight - System.Convert.ToDouble(datagrid.Tag); } }

    Read the article

  • What is the least intrusive way to display WPF tooltip on focus?

    - by Andrey Shchekin
    What is the minimum number of steps required to display a tooltip when the following control gets focus? <TextBox ToolTip="Hello there!" ... /> I tried the following in GotFocus private void ..._GotFocus(object sender, RoutedEventArgs e) { var element = (FrameworkElement)sender; var tooltip = element.ToolTip; if (!(tooltip is ToolTip)) { tooltip = new ToolTip { Content = tooltip }; element.ToolTip = tooltip; } ((ToolTip)tooltip).IsOpen = true; } However, it seems to ignore the ToolTipService.Placement for this control and SystemParameters.ToolTipPopupAnimationKey set up level higher. How can I make it work and honor all settings that generally work for tooltips (except the timing, obviously)?

    Read the article

  • bluetooth file send.

    - by cheesebunz
    i'm new to bluetooth development and i found the 32netfeet . Right now i'm able to search for bluetooth devices nearby and connect to them but how do i send a file e.g SendTest.txt? I tried buttonclick event using the OBEX but i don't understand this is my example code: using InTheHand.Net; using InTheHand.Net.Sockets; using InTheHand.Net.Bluetooth; namespace BluetoothIntheHand { public partial class Form2 : Form { private Guid service = BluetoothService.DialupNetworking; private BluetoothClient bluetoothClient; public Form2() { InitializeComponent(); } private void btnSearch_Click(object sender, EventArgs e) { BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable; BluetoothRadio myRadio = BluetoothRadio.PrimaryRadio; lblSearch.Text = "" + myRadio.LocalAddress.ToString(); bluetoothClient = new BluetoothClient(); Cursor.Current = Cursors.WaitCursor; BluetoothDeviceInfo[] bluetoothDeviceInfo = { }; bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10); comboBox1.DataSource = bluetoothDeviceInfo; comboBox1.DisplayMember = "DeviceName"; comboBox1.ValueMember = "DeviceAddress"; comboBox1.Focus(); Cursor.Current = Cursors.Default; } private void btnConnect_Click(object sender, EventArgs e) { if (comboBox1.SelectedValue != null) { try { bluetoothClient.Connect(new BluetoothEndPoint((BluetoothAddress)comboBox1.SelectedValue, service)); MessageBox.Show("Connected"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } private void btnSend_Click(object sender, EventArgs e) { bluetoothClient.Connect(new BluetoothEndPoint((BluetoothAddress)comboBox1.SelectedValue, service)); String addr = "112233445566"; Uri uri = new Uri("obex://"+@"SendTest.txt"); ObexWebRequest req= new ObexWebRequest(uri); ObexWebResponse rsp; } I found the guide but don't really know how to convert to C# ' The host part of the URI is the device address, e.g. IrDAAddress.ToString(), ' and the file part is the OBEX object name. Dim addr As String = "112233445566" Dim uri As New Uri("obex://" & addr & "/HelloWorld2.txt") Dim req As New ObexWebRequest(uri) Using content As Stream = req.GetRequestStream() ' Using a StreamWriter to write text to the stream... Using wtr As New StreamWriter(content) wtr.WriteLine("Hello World GetRequestStream") wtr.WriteLine("Hello World GetRequestStream 2") wtr.Flush() ' Set the Length header value req.ContentLength = content.Length End Using ' In this case closing the StreamWriter also closed the Stream, but ... End Using Dim rsp As ObexWebResponse = CType(req.GetResponse(),ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode)

    Read the article

  • GIgya Native Login without using Facebook and Twitter Account

    - by Wodjefer
    Following code that i am using to login but i am getting a Null response - (IBAction) signInPressed : (id)sender { [super signInPressed:sender]; NSLog(@"ACCLoginViewController_iPhone Sign-IN Pressed"); //Load the Gigya login UI component, passing this View Controller as a delegate. GSRequest *request = [GSRequest requestForMethod:@"accounts.login"]; [request.parameters setObject:self.emailField.text forKey:@"loginID"]; [request.parameters setObject:self.passwordField.text forKey:@"password"]; request.parameters[@"loginID"] = @"email"; [request sendWithResponseHandler:^(GSResponse *response, NSError *error) { if (!error) { NSLog(@"the resposne = %@",response); } else { // Check the error code according to the GSErrorCode enum, and handle it. NSLog(@"the Error = %@",error.description); } }]; // [self loadTabbar]; }

    Read the article

  • 'NSInvalidArgumentException' UIButton IBAction Error

    - by Graeme
    Hi, I have a button in a view which refuses to work. I've got in working in a blank, default view application from X-Code, but in none of my applications will it work, instead it gives me the following error. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UIViewController showVicInfo:]: unrecognized selector sent to instance 0x3c084f0' The debugger isn't any help either. I've made sure that I hook up the button to the file's owner (not the other way around) as well. Below is the code for the action. And I know it's not the alert view, because the breakpoint doesn't even reach there. about.h @interface about : UIViewController { } -(IBAction)showInfo:(id)sender; about.m -(IBAction)showVicInfo:(id)sender { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for iFirelert to work." delegate:self cancelButtonTitle:@"OK, thanks" otherButtonTitles:nil]; [myAlert show]; [myAlert release]; }

    Read the article

  • Adding image to RichTextBox programatically does not show in Xaml property

    - by rotary_engine
    Trying to add an image to a RichTextBox progamatically from a Stream. The image displays in the text box, however when reading the Xaml property there is no markup for the image. private void richTextBox3_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { FileInfo[] files = (FileInfo[])e.Data.GetData(DataFormats.FileDrop); using (Stream s = files[0].OpenRead()) { InlineUIContainer container = new InlineUIContainer(); BitmapImage bmp = new BitmapImage(); bmp.SetSource(s); Image img = new Image(); img.SetValue(Image.SourceProperty, bmp); container.Child = img; richTextBox3.Selection.Insert(container); } } } private void Button_Click_1(object sender, RoutedEventArgs e) { // this doesn't have the markup from the inserted image System.Windows.MessageBox.Show(richTextBox3.Xaml); } What is the correct way to insert an image into the RichTextBox at runtime so that it can be persisted to a data store? In the Xaml property.

    Read the article

  • WinForms Form won't close on pressing X or Close() in C#

    - by MadBoy
    I'm having a bit weird problem with WinForm which seems to refuse to close for some weird reason. I've got very simple gui which sometimes doesn't react for me pressing X or when i use events on buttons it even reaches Close() and does nothing.. private void buttonZapisz_Click(object sender, EventArgs e) { string plik = textBoxDokumentDoZaladowania.Text; if (File.Exists(plik)) { string extension = Path.GetExtension(plik); string nazwaPliku = Path.GetFileName(plik); SqlMethods.databaseFilePut(plik, comboBoxTypDokumentu.Text, textBoxKomentarz.Text, sKlienciID, sPortfelID, extension, nazwaPliku); Close(); } } There are no events assigned to FormClosed or FormClosing. So how can I find out what's wrong. Sometimes X will work after the GUI is loaded but after i press Button to save some stuff to database it reaches Close() in that button event and it still is visible and does nothing. Can't use X, nor ALT+F4. I can go around GUI and choose other values for ComboBox without problem. I call GUI like this: private void contextMenuDokumentyDodaj_Click(object sender, EventArgs e) { var lv = (ListView) contextMenuDokumenty.SourceControl; string varPortfelID = Locale.ustalDaneListViewKolumny(listViewNumeryUmow, 0); string varKlienciID = Locale.ustalDaneListViewKolumny(listViewKlienci, 0); if (lv == listViewDokumentyPerKlient) { if (varKlienciID != "") { var dokumenty = new DocumentsGui(varKlienciID); dokumenty.Show(); dokumenty.FormClosed += varDocumentsGuiKlienci_FormClosed; } } else if (lv == listViewDokumentyPerPortfel) { if (varPortfelID != "" && varKlienciID != "") { var dokumenty = new DocumentsGui(varKlienciID, varPortfelID); dokumenty.Show(); dokumenty.FormClosed += varDocumentsGuiPortfele_FormClosed; } } } While I can't close GUI i can work on the main gui without problem too. I can open up same GUI and after opening new GUI i can quickly close it. GUI is very simple with few ComboBoxes,TextBoxes and one EditButton from Devexpress. Edit: varDocumentsGuiPortfele_FormClosed code allows me to refresh GUI (reload ListView's depending on where the user is on now). private void varDocumentsGuiPortfele_FormClosed(object sender, FormClosedEventArgs e) { TabControl varTabControl = tabControlKlientPortfele; if (varTabControl.TabPages.IndexOf(tabPageDokumentyPerKlient) == varTabControl.SelectedIndex) { loadTabControlKlientPortfeleBezZmianyUmowy(); } }

    Read the article

  • Save scrollbar Div, in a MasterPage

    - by Luis
    have got succesfull done it in the content pages, but in the masterpage, I am not able to done it. I tried this way, it was like I did for content pages. <script type="text/javascript"> // This Script is used to maintain Grid Scroll on Partial Postback var scrollTop; //Register Begin Request and End Request Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); //Get The Div Scroll Position function BeginRequestHandler(sender, args) { var m = document.getElementById('<%=PanelMenuLeft.ClientID%>'); m.scrollTop = scrollTop; } //Set The Div Scroll Position function EndRequestHandler(sender, args) { var m = document.getElementById('<%=PanelMenuLeft.ClientID%>'); m.scrollTop = scrollTop; } </script>

    Read the article

  • How to call WCF Service Method Asycroniously from Class file?

    - by stackuser1
    I've added WCF Service reference to my asp.net application and configured that reference to support asncronious calls. From asp.net code behind files, i'm able to call the service methods asyncroniously like the bellow sample code. protected void Button1_Click(object sender, EventArgs e) { PageAsyncTask pat = new PageAsyncTask(BeiginGetDataAsync, EndDataRetrieveAsync, null, null); Page.RegisterAsyncTask(pat); } IAsyncResult BeiginGetDataAsync(object sender, EventArgs e, AsyncCallback async, object extractData) { svc = new Service1Client(); return svc.BeginGetData(656,async, extractData); } void EndDataRetrieveAsync(IAsyncResult ar) { Label1.Text = svc.EndGetData(ar); } and in page directive added Async="true" In this scenario it is working fine. But from UI i'm not supposed to call the service methods directly. I need to call all service methods from a static class and from code behind file i need to invoke the static method. In this scenario what exactlly do i need to do?

    Read the article

  • WebClient DownloadStringCompleted Never Fired in Console Application

    - by azamsharp
    I am not sure why the callback methods are not fired AT ALL. I am using VS 2010. static void Main(string[] args) { try { var url = "some link to RSS FEED"; var client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadStringAsync(new Uri(url)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } // THIS IS NEVER FIRED static void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { Console.WriteLine("something"); } // THIS IS NEVER FIRED static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { Console.WriteLine("do something"); var rss = XElement.Parse(e.Result); var pictures = from item in rss.Descendants("channel") select new Picture { Name = item.Element("title").Value }; foreach (var picture in pictures) { Console.WriteLine(picture.Name); Console.WriteLine(picture.Url); } }

    Read the article

  • LLBLGenProDataSource : cannot see updates values of newly inserted item from a FormView

    - by tbone
    After performing a FormView.InsertItem, I am unable to read the new values from the bound object within the LLBLGenProDataSource that the FormView is bound to. I have tracing turned on, I can see the insert happen, and the data does make it into the database, yet when I examine the contents of LLBLGenProDataSource.EntityCollection(0) (there is only one item in the collection) I do not see the values from the FormView.....yet, they are somehow being inserted into the database. Relevant code: <llblgenpro:LLBLGenProDataSource ID="llbDataSource" runat="server" MaxNumberOfItemsToReturn="1" DataContainerType="EntityCollection" EntityCollectionTypeName="Domain.CollectionClasses.MetricCollection, Domain" LivePersistence="True" ThrowExceptionOnIllegalFieldInput="true" /> Private Sub frmEdit_ItemCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmEdit.ItemCreated If Me.llbDataSource.EntityCollection.Count = 0 Then Me.frmEdit.ChangeMode(FormViewMode.Insert) Me.llbDataSource.EntityCollection.Add(New MetricEntity) Me.frmEdit.DataBind() Else LoadDropdowns() End If End Sub Private Sub cmdSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSave.Click If Me.frmEdit.CurrentMode = FormViewMode.Edit Then Me.frmEdit.UpdateItem(False) ElseIf Me.frmEdit.CurrentMode = FormViewMode.Insert Then Me.frmEdit.InsertItem(False) 'Me.llbDataSource.DataBind() 'NOPE! Response.Redirect("~/MetricDetail.aspx?MetricCode=" & Me.llbDataSource.EntityCollection(0).Fields("MetricCode").CurrentValue.ToString) End If End Sub

    Read the article

  • Winforms Hotkey, Help?

    - by Di4g0n4leye
    namespace WebBrowser { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } int GetPixel(int x, int y) { Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppPArgb); Graphics grp = Graphics.FromImage(bmp); grp.CopyFromScreen(new Point(x,y), Point.Empty, new Size(1,1)); grp.Save(); return bmp.GetPixel(0, 0).ToArgb(); } void Button1Click(object sender, EventArgs e) { int x = Cursor.Position.X; int y = Cursor.Position.Y; int pixel = GetPixel(x,y); textBox1.Text = pixel.ToString(); } void MainFormLoad(object sender, EventArgs e) { webBrowser1.Navigate("http://google.com"); } } } } i want to add a hotkey that call Button1 on Press, How can that be done?

    Read the article

  • Why does DataSet.HasChanges() return true if called in the same function as change but false otherwi

    - by Chapso
    Assuming that the buttons are being clicked in order, the following code modifies row 1 in a .net DataSet, then row 0. HasChanges returns true, but GetChanges only gives me the change for row 0. If I comment out the line in the button2 click event that modifies row 0, then HasChanges returns false. Can anyone explain to me why HasChanges() and GetChanges() only return true when they are called in the same function as the change to the DataSet? Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click __ds1.Tables(0).Rows(1)("EmployeeName") = "TestStuff" End Sub Protected Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click __ds1.Tables(0).Rows(0)("EmployeeName") = "TestStuff" If __ds1.HasChanges(DataRowState.Modified Or DataRowState.Added) Then __ds2 = __ds1.GetChanges(DataRowState.Modified _ Or DataRowState.Added) GridView3.DataSource = __ds2.Tables("Users").DefaultView GridView3.DataBind() Else End If End Sub

    Read the article

  • Asynchronous Silverlight WCF callback

    - by Matt
    I've created my own WCF service and I've successfully been able to talk to it via my Silverlight client. I ran into an interesting problem on my asynchronous callbacks though. When my callback is invoked, I can't update any UI controls with the dreaded invalid cross thread access Here's what my callback function looks like private void GetTimeCallBack( object sender, Talk.ClientBase<IService>.ClientEventArgs e ) { lblDisplay.Text = e.Object.ToString(); } A quick google search showed me that I have to do this instead. private void GetTimeCallBack( object sender, Talk.ClientBase<IService>.ClientEventArgs e ) { Dispatcher.BeginInvoke( () => lblDisplay.Text = e.Object.ToString() ); } Now everything works fine, but I wasn't expecting my callback to be running on a different thread. Will I always have to use the Dispatcher class in order to modify anything within my class or is this just limited to UI elements? I've not familiar with the Dispatcher class at all so I'm looking to understand it more.

    Read the article

  • How to access drop down list from EditItemTemplate of FormView

    - by IrfanRaza
    Hello friends, I have a formview on my aspx page containing various controls arranged using table. There is a DDL "cboClients" which i need to enable or disabled depending upon role within Edit mode. The problem here is that i am not able to get that control using FindControl() method. I have tried following code - DropDownList ddl = null; if (FormView1.Row != null) { ddl = (DropDownList)FormView1.Row.FindControl("cboClients"); ddl.Enabled=false; } Even I ave used the DataBound event of the same control - protected void cboClients_DataBound(object sender, EventArgs e) { if (FormView1.CurrentMode == FormViewMode.Edit) { if ((Session["RoleName"].ToString().Equals("Clients")) || (Session["RoleName"].ToString().Equals("Suppliers"))) { DropDownList ddl = (DropDownList)sender; ddl.Enabled = false; } } } But this databound event occurs only once, but not when formview mode is changed. Can anyone provide me proper solution? Thanks for sharing your time.

    Read the article

  • MissingMethodException in C# Program

    - by draghia-aurelian
    I wrote a Windows Form Application in C# and it works well for my computer. But on another PC, an error occurs when I try to do some stuff. MenuItem_Click Event Handler private void rUNToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("I'm in rUNToolStripMenuItem_Click!"); ... } ToolStripMenuItem Event Handler private void dataPositionToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("I'm in dataPositionToolStripMenuItem_Click!"); ... } Running on my computer: MenuItem_ClickEvent Handler Output (On My PC) MessageBox appears: "I'm in rUNToolStripMenuItem_Click" ToolStripMenuItem Event Handler (On My PC) MessageBox appears: "I'm in dataPositionToolStripMenuItem_Click!" MenuItem_Click Event Handler: (On another PC) Messagebox doesn't appear and an Exception is thrown Method not found: "Void Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder.ctor( System.String.System.Type, System.Collections.Generic.IEnumerable'1<Microsoft .CSharp.RuntimeBinder.CSharpArgument Info>)'. This is the PrintScreen with error: What am I doing wrong?

    Read the article

  • Outlook MAPI session exception when outlook interface is closed

    - by michele
    I'm developing a email sender that retrieve data from a database, build up a MailItem with the Outlook Interop and send it. My email sender is running by a windows service that is notified everytime there's some data to send. I'm logging on the MAPI session of Outlook without problem and everything seems to work. But... when someone open Outlook interface and then close, my service crash at the first attempt i call a SendAndReceive method, with an exception that report that the session is assigned to another thread. I'm googling around for hours and i'm listening to the application_quit event, raised by the interface closing, trying to logoff and logon again to the application...but i'm still falling in the same error. Where am i wrong?Any suggestion? Thank you in advance

    Read the article

  • Sending mail with delivery receipt ?

    - by Mina Samy
    Hi all I use a function that sends emails to some users. I use the following code to send delivery notification failure messages to the sender email when a message fails to reach the user. I use the following code. System.Web.Mail.MailMessage messagetest = new System.Web.Mail.MailMessage(); messagetest.Headers.Add("Disposition-Notification-To", txtFrom.Text); now I want to enable the sender to receive a Delivered receipt message when the mail arrives successfully. how can this be done ? thanks

    Read the article

  • How to make a web browser with tabbed browsing with vb 2008?

    - by felixd68
    I've tried multiple times to create a web browser with tabbed browsing. I know that I have to use "tab control". I have succeeded in creating a semi-tabbed browsing. People are able to add new tabs, but the webbrowser component only appears in one tab page. Coding: Form1_Load: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Browse As New WebBrowser TabControl1.TabPages.Add(1, "TabPage" & i) TabControl1.SelectTab(1 - 1) Browse.Name = "wb" Browse.Dock = DockStyle.Fill TabControl1.SelectedTab.Controls.Add(Browse) i = i + 1 End Sub Web Browser Component Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) url.Text = e.Url.ToString() 'your url text box will show the actual url of the page after the page is fully loaded url.Text = e.Url.ToString Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Webbrowser's name" TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle End Sub

    Read the article

  • disable event-bubbling c# wpf

    - by Ruben
    Hi, I'm having the following problem: When I got two labels into each other: <Label x:Name="First" MouseUp="Label_MouseUp"> <Label x:Name="Second" MouseUp="Label_MouseUp_1">This is a label into another label</Label> </Label> And the following code: private void Label_MouseUp(object sender, MouseButtonEventArgs e) { Console.WriteLine("Do NOT show me"); } private void Label_MouseUp_1(object sender, MouseButtonEventArgs e) { Console.WriteLine("Show me"); } When i click "Second", I want it to trigger only "Label_MouseUp_1". But in my console i get: Show me Do NOT show me Is there a way to turn off the bubbling events? (also, "First" has to be clickable, so removing the event there doesn't solve the problem) Thnx

    Read the article

  • C#: BackgroundWorker cloning resources?

    - by Dav
    The problem I've been struggling with this partiular problem for two days now and just run out of ideas. A little... background: we have a WinForms app that needs to access a database, construct a list of related in-memory objects from that data, and then display on a DataGridView. Important point is that we first populate an app-wide cache (List), and then create a mirror of the cache local to the form on which the DGV lives (using List constructor param). Because fetching the data takes a good few seconds (DB sits on a LAN server) to load, we decided to use a BackgroundWorker, and only refresh the DGV once the data is loaded. However, it seems that doing the loading via a BGW results in some memory leak... or an error on my part. When loaded using a blocking method call, the app consumes about 30MB of RAM; with a BGW this jumps to 80MB! While it may not seem as much anyway, our clients are not too happy about it. Relevant code Form private void MyForm_Load(object sender, EventArgs e) { MyRepository.Instance.FinishedEvent += RefreshCache; } private void RefreshCache(object sender, EventArgs e) { dgvProducts.DataSource = new List<MyDataObj>(MyRepository.Products); } Repository private static List<MyDataObj> Products { get; set; } public event EventHandler ProductsLoaded; public void GetProductsSync() { List<MyDataObj> p; using (MyL2SDb db = new MyL2SDb(MyConfig.ConnectionString)) { p = db.PRODUCTS .Select(p => new MyDataObj {Id = p.ID, Description = p.DESCR}) .ToList(); } Products = p; // tell the form to refresh UI if (ProductsLoaded != null) ProductsLoaded(this, null); } public void GetProductsAsync() { using (BackgroundWorker myWorker = new BackgroundWorker()) { myWorker.DoWork += delegate { List<MyDataObj> p; using (MyL2SDb db = new MyL2SDb(MyConfig.ConnectionString)) { p = db.PRODUCTS .Select(p => new MyDataObj {Id = p.ID, Description = p.DESCR}) .ToList(); } Products = p; }; // tell the form to refresh UI when finished myWorker.RunWorkerCompleted += GetProductsCompleted; myWorker.RunWorkerAsync(); } } private void GetProductsCompleted(object sender, RunWorkerCompletedEventArgs e) { if (ProductsLoaded != null) ProductsLoaded(this, null); } End! GetProductsSync or GetProductsAsync are called on the main thread, not shown above. Could it be that the GarbageCollector just gets lost with two threads? Or is it the task manager that shows incorrect values? Will be greateful for any responses, suggestions, criticism.

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >