本文整理汇总了C#中Service类的典型用法代码示例。如果您正苦于以下问题:C# Service类的具体用法?C# Service怎么用?C# Service使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Service类属于命名空间,在下文中一共展示了Service类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: USB_Rejoin
public USB_Rejoin(Service s, string sl)
{
InitializeComponent();
service = s;
serial.Text = sl;
}
示例2: Load
public static DisaSettings Load(Service ds)
{
var path = GetPath(ds);
if (!File.Exists(path))
{
return null;
}
try
{
using (var sr = new StreamReader(path))
{
var loadedObj = Load(sr, ds.Information.Settings);
return loadedObj;
}
}
catch (Exception ex)
{
Utils.DebugPrint("Failed (exception) to load settings for "
+ ds.Information.ServiceName + ". Nuking!");
File.Delete(path);
return null;
}
}
示例3: Init
public void Init(Service service)
{
DataContext = contentManagerViewModel = new ContentManagerViewModel(service);
service.ContentUpdated += (type, name) =>
{
RefreshContentList();
ContentLoader.RemoveResource(name);
if (isContentReadyForUse)
Dispatcher.Invoke(
new Action(
() =>
contentManagerViewModel.SelectedContent =
new ContentIconAndName(contentManagerViewModel.GetContentTypeIcon(type), name)));
};
service.ContentDeleted += name =>
{
RefreshContentList();
ContentLoader.RemoveResource(name);
};
service.ProjectChanged += () =>
{
isContentReadyForUse = false;
RefreshContentList();
};
service.ContentReady += () =>
{
Dispatcher.Invoke(new Action(contentManagerViewModel.ShowStartContent));
isContentReadyForUse = true;
};
}
示例4: Load
private static DisaServiceUserSettings Load(Service service)
{
var path = GetPath(service);
if (!File.Exists(path))
{
return null;
}
try
{
using (var sr = new StreamReader(path))
{
var serializer = new XmlSerializer(typeof(DisaServiceUserSettings));
return (DisaServiceUserSettings) serializer.Deserialize(sr);
}
}
catch (Exception ex)
{
Utils.DebugPrint("Failed to load service user settings for " + service.Information.ServiceName +
". Corruption. Nuking... " + ex.Message);
if (File.Exists(path))
{
File.Delete(path);
}
}
return null;
}
示例5: AddWindow
public AddWindow(Requests request, Service.Service service)
{
this.InitializeComponent();
this.InitializeMembers(service);
this.InitializeComboBoxes();
// Fill TextBoxes
this.textBoxClient.Text = request.Clients.FullName;
this.textBoxAdress.Text = request.Address;
this.textBoxComment.Text = request.Comment;
// Fill ComboBoxes
this.comboBoxServices.SelectedIndex = this.comboBoxServices.FindStringExact(request.Services.Name);
this.comboBoxOperators.SelectedIndex = this.comboBoxOperators.FindStringExact(request.Operators.FullName);
this.comboBoxMasters.SelectedIndex = this.comboBoxMasters.FindStringExact(request.Masters.FullName);
// Fill DateTimePickers
this.dateTimePickerRequest.Value = request.RequestDate;
this.dateTimePickerCloseRequest.Value = request.CloseDate ?? DateTime.Now;
this.dateTimePickerDepature.Value = request.DateOfDeparture ?? DateTime.Now;
this.buttonAdd.Text = "Изменить";
this.isEditMode = true;
this.requestToEdit = request;
}
示例6: MedicsWindow
public MedicsWindow()
{
InitializeComponent();
medico = new Medicos();
medic = new Medic();
service = new Service();
speciality = new Speciality();
medics = medic.GetAll();
medicsGrid.ItemsSource = medics.ToArray();
services = service.GetAll();
foreach (ServicioMedico service in services)
{
comboService.Items.Add(service.nombre + " - " + service.descripcion);
}
specialities = speciality.GetAll();
foreach (Especialidades speciality in specialities)
{
comboSpeciality.Items.Add(speciality.nombre + " - " + speciality.descripcion);
}
}
示例7: Manager
public Manager()
{
dbus_connection = Bus.GetSystemBus();
dbus_service = Service.Get(dbus_connection, INTERFACE_NAME);
manager = (ManagerProxy)dbus_service.GetObject(typeof(ManagerProxy), PATH_NAME);
dbus_service.SignalCalled += OnSignalCalled;
}
示例8: ComposeBubble
public ComposeBubble(long time, BubbleDirection direction, Service service,
VisualBubble bubbleToSend, Contact.ID[] ids)
: base(time, direction, service)
{
Ids = ids;
BubbleToSend = bubbleToSend;
}
示例9: Main
private static void Main(string[] args)
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
if (!Environment.UserInteractive) // Running as service
{
using (var service = new Service())
ServiceBase.Run(service);
}
else // Running as console app
{
var parameter = string.Concat(args);
switch (parameter)
{
case "--install":
ManagedInstallerClass.InstallHelper(new[]
{"/LogFile=", Assembly.GetExecutingAssembly().Location});
return;
case "--uninstall":
ManagedInstallerClass.InstallHelper(new[]
{"/LogFile=", "/u", Assembly.GetExecutingAssembly().Location});
return;
}
Start(args);
}
}
示例10: MessageIntradayTick
internal MessageIntradayTick(CorrelationID corr, Service service)
: base(new Name("IntradayTickResponse"), corr, service)
{
this._parent = null;
this._responseError = new ElementIntradayTickResponseError();
this._isResponseError = true;
}
示例11: RegisterDomainSyncAPI
/// <summary>
/// Registers the domain sync APIs in the provided service.
/// </summary>
/// <param name="service">The provided service.</param>
public void RegisterDomainSyncAPI(Service service)
{
service["serverSync.getDoR"] = (Func<string>)GetDoR;
service["serverSync.getDoI"] = (Func<string>)GetDoI;
service["serverSync.updateDoI"] = (Action<Connection, string>)HandleRemoteDoIChanged;
service["serverSync.updateDoR"] = (Action<Connection, string>)HandleRemoteDoRChanged;
}
示例12: SleepProcessor
public SleepProcessor(ProcessorElement config, Service service)
: base(config, service)
{
mode = SleepMode.Normal;
if (config.Options["mode"] != null && !string.IsNullOrEmpty(config.Options["mode"].Value))
{
foreach (SleepMode item in Enum.GetValues(typeof(SleepMode)))
{
if (item.ToString().ToLower().Equals(config.Options["mode"].Value.ToLower()))
mode = item;
}
}
interval = null;
if (config.Options["interval"] != null && !string.IsNullOrEmpty(config.Options["interval"].Value))
{
interval = config.Options["interval"].Value;
}
else
{
Log.Warn("sleep interval not defined");
}
if (mode == SleepMode.Random)
{
rnd = new Random();
}
}
示例13: ComponentNotRegisteredException
/// <summary>
/// Initializes a new instance of the <see cref="ComponentNotRegisteredException"/> class.
/// </summary>
/// <param name="service">The service.</param>
/// <param name="innerException">The inner exception.</param>
public ComponentNotRegisteredException(Service service, Exception innerException)
: base(string.Format(CultureInfo.CurrentCulture,
ComponentNotRegisteredExceptionResources.Message,
Enforce.ArgumentNotNull(service, "service")),
innerException)
{
}
示例14: EditWindow
public EditWindow(Service.Service service, int rowIndex, object selectedItem, DataGrid grid)
{
InitializeComponent();
this.selectedItem = selectedItem;
this.service = service;
this.rowIndex = rowIndex;
this.grid = grid;
this.grid.IsReadOnly = true;
List<String> categories = new List<String>();
categories.Add("Discount pris");
categories.Add("Hverdags oste");
categories.Add("Luxus oste");
categories.Add("Eksklusive oste");
categories.Add("Styk ost");
categories.Add("Osteborde");
comboBoxCategoryEdit.ItemsSource = categories.ToList();
TxtName.Text = service.filldata(service.getProducts()).Rows[rowIndex]["name"].ToString();
txtUnitprice.Text = service.filldata(service.getProducts()).Rows[rowIndex]["unitPrice"].ToString();
txtCountAvailable.Text = service.filldata(service.getProducts()).Rows[rowIndex]["countAvailable"].ToString();
txtCountry.Text = service.filldata(service.getProducts()).Rows[rowIndex]["country"].ToString();
txtDescription.Text = service.filldata(service.getProducts()).Rows[rowIndex]["description"].ToString();
}
示例15: Run
private void Run()
{
Console.WriteLine("Run a ServiceHost via programmatic configuration...");
Console.WriteLine();
string baseAddress = "http://" + Environment.MachineName + ":8000/Service.svc";
Console.WriteLine("BaseAddress: {0}", baseAddress);
using (ServiceHost serviceHost = new ServiceHost(typeof(Service)))
{
Console.WriteLine("Opening the host");
serviceHost.Open();
try
{
var service = new Service();
Console.WriteLine(service);
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
}
catch (Exception ex)
{
Console.WriteLine("Error on initializing the service host.");
Console.WriteLine(ex.Message);
}
Console.WriteLine();
Console.ReadLine();
serviceHost.Close();
}
}