16,022,418 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 7983150 (Top 8 by date)
Member 7983150
3-May-12 14:56pm
View
And this is the code of the Timer in the Class AS400duplicate:
//Timer
private System.Diagnostics.EventLog _AppEventLog;
private System.Timers.Timer _Timer;
private int _Interval = 1000;
public int Interval
{
get { return this._Interval;}
set { this._Interval = value; }
}
private string _Name = "";
public string Name
{
get { return this._Name; }
set { this._Name = value; }
}
///
/// /// Constructor
/// ///
public void TimedItem(System.Diagnostics.EventLog AppEventLog)
{
this._Timer = new System.Timers.Timer();
this._Timer.Elapsed += new
System.Timers.ElapsedEventHandler(_Timer_Elapsed);
this._Timer.Enabled = false;
this._Timer.Interval = this.Interval;
this._AppEventLog = AppEventLog;
}
///
/// /// Start the timer.
/// ///
public void StartTimer()
{
this._Timer.Enabled = true;
}
///
/// Stop the timer.
/// ///
public void StopTimer()
{
this._Timer.Enabled = false;
}
/* * Respond to the _Timer elapsed event. */
private void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
DateTime Zeit = DateTime.Now;
if (Zeit.ToString("mm") == "25") //(Zeit.ToString("HH") == "22")
{
if (Funktion_ausfuehren == true)
{
Offline();
}
}
if (Zeit.ToString("mm") == "30") //(Zeit.ToString("HH") == "02")
{
if (Funktion2_ausfuehren == true)
{
Online();
}
}
}
It´s only function is to activate the functions: Offline and Online at a particular time.
The problem appears when I try to start the timer at the OnStart function.
When I try to start the Service, the errormessage I already posted appears.
Member 7983150
3-May-12 14:50pm
View
This is the code of the Service:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Collections;
using System.Globalization;
using System.Reflection;
namespace Project1
{
class WindowsService : ServiceBase
{
AS400duplicate ASdb = new AS400duplicate();
public WindowsService()
{
this.ServiceName = "AS400 duplizieren";
//this.EventLog.Log = "Application";
// These Flags set whether or not to handle that specific
// type of event. Set to true if you need it, false otherwise.
this.CanHandlePowerEvent = true;
this.CanHandleSessionChangeEvent = true;
this.CanPauseAndContinue = true;
this.CanShutdown = true;
this.CanStop = true;
}
///
/// The Main Thread: This is where your Service is Run.
///
static void Main()
{
ServiceBase.Run(new WindowsService());
}
///
/// Dispose of objects that need it here.
///
/// <param name="disposing">Whether
/// or not disposing is going on.</param>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
///
/// OnStart(): Put startup code here
/// - Start threads, get inital data, etc.
///
/// <param name="args"></param>
protected override void OnStart(string[] args)
{
base.OnStart(args);
ASdb.StartTimer();
}
///
/// OnStop(): Put your stop code here
/// - Stop threads, set final data, etc.
///
protected override void OnStop()
{
base.OnStop();
}
///
/// OnPause: Put your pause code here
/// - Pause working threads, etc.
///
protected override void OnPause()
{
base.OnPause();
}
///
/// OnContinue(): Put your continue code here
/// - Un-pause working threads, etc.
///
protected override void OnContinue()
{
base.OnContinue();
}
///
/// OnShutdown(): Called when the System is shutting down
/// - Put code here when you need special handling
/// of code that deals with a system shutdown, such
/// as saving special data before shutdown.
///
protected override void OnShutdown()
{
base.OnShutdown();
}
///
/// OnCustomCommand(): If you need to send a command to your
/// service without the need for Remoting or Sockets, use
/// this method to do custom methods.
///
/// <param name="command">Arbitrary Integer between 128 & 256</param>
protected override void OnCustomCommand(int command)
{
// A custom command can be sent to a service by using this method:
//# int command = 128; //Some Arbitrary number between 128 & 256
//# ServiceController sc = new ServiceController("NameOfService");
//# sc.ExecuteCommand(command);
base.OnCustomCommand(command);
}
///
/// OnPowerEvent(): Useful for detecting power status changes,
/// such as going into Suspend mode or Low Battery for laptops.
///
/// <param name="powerStatus">The Power Broadcast Status
/// (BatteryLow, Suspend, etc.)</param>
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
{
return base.OnPowerEvent(powerStatus);
Member 7983150
3-May-12 13:16pm
View
Hi Dave,
I declared it Global but it still doesn´t work.
Same error.
By the way, it´s really an IBM AS400 in my company and I have to duplicate data from it and put it on the SQL-Server...
Member 7983150
12-Mar-12 2:21am
View
Hi Björn,
sorry for answering only now.
It works but you have to modify the youtube link to your format.
You get a string like that:
http://www.youtube.com/watch?v=ykwAirfRulg&feature=g-logo&context=G20b913cFOAAAAAAAXAA
Now I need to filter the 'ykwAirfRulg' and put it into:
http://www.youtube.com/embed/ykwAirfRulg?autoplay=1
Now it works thank you very much!!!
Tom
Member 7983150
6-Mar-12 1:09am
View
Hi,
it doesn´t work either.
I´ve created 2 buttons, both of them have different URLs and your &autoplay=1.
If I click on the first button it works but if I click now the second button it doesn´t work anymore. Do I have to close or clear the webelement???
Best regards
Tom
Member 7983150
20-Feb-12 1:03am
View
I thought about that but the library works in C only.
I think there is no point of doing it that amateurish way, I have to find
the problem in my subroutine.
Thank you for your help anyway.
Member 7983150
17-Feb-12 7:08am
View
Hi,
to do that with a Windows Service is a good idea, but my subroutine is written in c++. I don´t know how to make a Windows Service out of it.
(fyi: this subroutine gets information of a Hardwaredevice and my mainprogramm written in c# handles the information)
When the c++ program crashes there comes this errormessage. Is it possible to notice that in any other way. Cause I don´t have much knowledge about Windows Services.
Thanks!
Member 7983150
23-Dec-11 4:48am
View
Hi
Nice player! Sure i could use it, but i would like to keep mine.
Thanks anyway!
Show More