|
I am getting the following error when trying to compile this code:
H:\Grid Project\Alchemi-1.0.4-src\src\Alchemi.ManagerServiceController\ManagerMainForm.cs(61): 'ManagerTemplateForm.components' is inaccessible due to its protection level
Here is the code that I am working with. I have a comment on the line where the error is thrown.
#region Alchemi copyright and license notice
#endregion
using System;
using System.ComponentModel;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;
using System.Windows.Forms;
using Alchemi.Core;
using Alchemi.Core.Manager;
using Alchemi.Manager;
using log4net;
[assembly: log4net.Config.XmlConfigurator(Watch=true)]
namespace Alchemi.ManagerService
{
public class ManagerMainForm : ManagerTemplateForm
{
public const string serviceName = "Alchemi Manager Service";
public ManagerMainForm():base()
{
InitializeComponent();
this.Text = "Alchemi Manager Service Controller";
Logger.LogHandler += new LogEventHandler(LogHandler);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container(); <big></big>
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ManagerMainForm));
this.SuspendLayout();
this.cbIntermediate.CheckedChanged += new System.EventHandler(this.cbIntermediate_CheckedChanged);
this.Name = "ManagerMainForm";
this.Text = "Alchemi Manager";
this.Load += new System.EventHandler(this.ManagerMainForm_Load);
this.ResumeLayout(false);
}
#endregion
private void LogHandler(object sender, LogEventArgs e)
{
ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
switch (e.Level)
{
case LogLevel.Debug:
string message = e.Source + ":" + e.Member + " - " + e.Message;
logger.Debug(message,e.Exception);
break;
case LogLevel.Info:
logger.Info(e.Message);
break;
case LogLevel.Error:
logger.Error(e.Message,e.Exception);
break;
case LogLevel.Warn:
logger.Warn(e.Message, e.Exception);
break;
}
}
private void ManagerMainForm_Load(object sender, EventArgs e)
{
ReadManagerConfig(false);
RefreshUIControls();
btStart.Focus();
}
private void ReadManagerConfig(bool useDefault)
{
ManagerContainer mc = new ManagerContainer();
mc.ReadConfig(useDefault);
Config = mc.Config;
mc = null;
}
private void cbIntermediate_CheckedChanged(object sender, EventArgs e)
{
Config.Intermediate = cbIntermediate.Checked;
_container.Config = Config;
RefreshUIControls();
}
#region Implementation of methods from ManagerTemplateForm
protected override bool Started
{
get
{
bool started = false;
try
{
ServiceController sc = new ServiceController(serviceName);
if (sc.Status == ServiceControllerStatus.Running || sc.Status == ServiceControllerStatus.StartPending)
{
started = true;
}
sc = null;
}
catch (Exception ex)
{
logger.Error("Error trying to determine service status",ex);
}
return started;
}
}
protected override void Exit()
{
this.Close();
Application.Exit();
}
protected override void ResetManager()
{
ReadManagerConfig(true);
RefreshUIControls();
}
protected override void StopManager()
{
if (!Started)
{
Log("The Manager Service is already stopped.");
RefreshUIControls();
return;
}
try
{
statusBar.Text = "Stopping Manager Service...";
Log("Stopping Manager Service...");
btStop.Enabled = false;
ServiceController sc = new ServiceController(serviceName);
if (sc.CanStop)
{
sc.Stop();
sc.WaitForStatus(ServiceControllerStatus.Stopped,new TimeSpan(0,0,28));
Log("Manager Service stopped.");
}
else
{
logger.Debug("Couldnot stop service: CanStop = false");
}
}
catch (TimeoutException)
{
Log("Timeout expired trying to stop Manager Service.");
}
catch (Exception ex)
{
Log("Error stopping ManagerService");
logger.Error(ex.Message, ex);
}
RefreshUIControls();
}
protected override void StartManager()
{
if (Started)
{
Log("Manager Service is already started.");
RefreshUIControls();
return;
}
try
{
btStart.Enabled = false;
btReset.Enabled = false;
btStop.Enabled = false;
statusBar.Text = "Starting Manager Service...";
Log("Attempting to start Manager Service...");
ServiceController sc = new ServiceController(serviceName);
if (sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending)
{
Config = GetConfigFromUI();
if (Config!=null)
{
Config.Slz();
}
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running,new TimeSpan(0,0,28));
Log("Manager Service started.");
}
}
catch (TimeoutException)
{
Log("Timeout expired trying to start Manager Service.");
}
catch (Exception ex)
{
Log("Error starting ManagerService");
logger.Error("Error starting ManagerService",ex);
StopManager();
}
RefreshUIControls();
}
#endregion
}
}
|
|
|
|
|
there are two possibilities which mean the same...
1. you forgot to specify the protection level of the component field in your managertemplateform which means by default that it is set to private
2. you didn't forget it but specify it to private...
Then if you want it to be not accessible by other class than children of the managertemplateform, you specify the protection level to protected...
if you agree that any classes access to it, choose public.
enjoy the code with you is my priority,
Blaise Braye
|
|
|
|
|
Hi every one
I wanted to know how to select Datagridview certain cell.. and highlight it..
for example.. Cell(ColumnIndex, RowIndex).. and then Highlight the cell...
I wanted also to highlight multiple cells.. and color different cells... I'm stuck with this problem for 2 days already..
some one told me about DataGridViewCell.Selected Property.. but i don't know how to use it to solve my problem
so please I need your help urgently...
I'm really appreciated for any hint..
Thanks in advance..
|
|
|
|
|
have you tried row.Cell[x].Style or row.DefaultCellStyle ?
|
|
|
|
|
First: Thanx for ur reply edboe
Second:
"row.Cell[x].Style" Couldn't find something like that
"row.DefaultCellStyle" didn't find something like that also ... but I found this
"DataGridView.DefaultCellStyle" but don't know who to use it to solve my problem..
the major thing for me is to highlight a certain Cell ... let the coloring of the cell be optional..
do u have or any body have any hints??
Thanks in advance...
|
|
|
|
|
If you do a foreach on the DataGridView rows, you will get an individual row. Then you can check your criteria, and change the colors accordingly.
|
|
|
|
|
Thank you very very much edboe for the great hint
Really appreciated..
best regards
|
|
|
|
|
To color cells individually:
dataGridView1.Rows[0].Cells[1].Style.BackColor=Color.YellowGreen;
dataGridView1.Rows[2].Cells[4].Style.BackColor=Color.AliceBlue;
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I'm really appreciated EricDV....
Thank you very very much
|
|
|
|
|
hello
i'm trying to bind data from a datatable to a textbox as there is only one value to be displayed.
the compiler says that there is no "DataSource" property for a textbox and neither a "DisplayMember" one as they work with datagrids and listViews.
can anuone tell me the replacement of DataSource and DisplayMember with a textBox.
waiting for ur reply
|
|
|
|
|
For databinding I always use the following code which works fine for me
<br />
textbox.DataBindings.Add("P", Datasource, Field)<br />
where "P" is the property of your textbox you wish to bind on (usually "Text")
Datasource is you datasource, for example, a datatable or dataview...
Fiels is the field in your datasource to bind on. For example the name of a column in your datasource.
|
|
|
|
|
Thank You
Eduard Keilholz
it worked just fine
regards
Saira
|
|
|
|
|
Hi all, I am so hoping that someone can help me out here. I'm writing an application for a terminal[^]. I'm only starting to learn C# and with this terminal and all its sort of a double learning curve for me although I am experienced in C++.
I've had plenty problems which I've managed to iron out one after the other but it seems that I have now reached a dead end where I simply lack the know-how to troubleshoot. When I compile my application it gives no warnings or errors. I can run it on the PC but when I copy it across to the device I get various exceptions. And what really concerns me is that I can't readily reproduce these exceptions. The three exceptions that I mostly get are InvalidProgramException , TypeLoadException and MissingMethodException .
When I comment out lines of code from my application, and these can be real meaningless lines such as MessageBox.Show("1st image loaded"); I get another exception. As I said, these exceptions seem not to be predictable and I never know which one I'm going to get - a bit like a box of chocolate (sorry, bad joke ).
Anyway, I would be very appreciative if someone could give me some advice as to how to get to the bottom of this. I'm getting really desperate.
Some background that might be of use:
The device runs Windows CE 4.2 and .NET CF 1.0
I'm using Visual Studio 2005
When creating the project I've selected Visual C# -> Smart Device -> Pocket PC 2003 -> Device Application (1.0)
This is because there is no option for Windows CE 4.2 (only 5.0) and I need to target the CF 1.0
When I create just a basic application with a form and some buttons etc. it does work on my device.
|
|
|
|
|
Hi everyone!
is that possible to edit labels of every column header of listView (if it is showing details view). Normally if we add a subitem to rows we cannot edit it.
What can we use similar to listView (Detail View) to edit every column in list.
Thanks.
|
|
|
|
|
Search the property Text of ColumnHeader object.
Example:
ListView1.Columns[0].Text = "My Favorite Column";
|
|
|
|
|
Hello all...
I looked around the forum for a solution, or a good heads up on my problem. Either blind,
or there really isn't an answer posted. So here's my situation.
I need to search through folders for files with a certain file extention [*.mp3]
And display the path to those files in a treeview.
So if a folder has MP3 files, it should display the folder name in the treeview, if not don't add to treeview.
If a folder does not contain MP3s, but its sub-folder(s) do, add folder name + subs to the treeview.
And so on and so forth...
[hmmm hope I'm making myself clear... ]
In the end, I should end-up with a treeview with folders containing mp3 files and folders whos
sub-folders contain mp3 files. In a "Window-Explorer-ish" style.
Then, in the end, when clicking on the node it lists the files in a listview...
Got the searching for MP3 files done, and displaying the contained files in the listview also done.
The trouble right now, is it's adding all folders and subs..even the ones not containing MP3s.
Any ideas anyone ?
Thanks...
LoneFerret
ps: If it helps, I can always paste the code I got so far... but it ain't pretty...
____________________________________________
Cross my heart, smack me dead...stick a lobster on my head.
|
|
|
|
|
If your search algorithm returns the fully qualified path to the MP3 file, you can use Path.GetDirectoryName(string) to return the directory information for the file. From that you can build your tree structure. You might need to split the string on the "\" character depending on how you want the tree to look.
If the search doesn't already return the fully qualified path, you may need to use Path.GetFullPath(string) , which will return the fully qualified path based on the current directory.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Thanks for the reply...
Been trying for the last few hours to only have the folder(s)(with their respective subs if any)
still with no success.
I understand your reasonning, for some reason I just get put it into practice...
Thanks again..
Loneferret
Cross my heart, smack me dead...stick a lobster on my head.
|
|
|
|
|
What are the problems you are running into? Can you post (or email) the code you have so far, particularly the code you are using to get the list of files?
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi...
I want to create a Log file in my application. I want to use this log file to put the text received & transmitted on my PC serial port throgh my C# application. I am receiving large text on my PC serial port. Is there is any special class to create a log file in C#. I dont want my text file every time to open & close to write text in that file since i have to put data in that text file on every receive data event of my serial comport.
How i can do this...?
Thanks ,
Vinay
|
|
|
|
|
|
Hi everyone
When we open an XML file in internet explorer we get text view of XML document. I want to display this un-editable text view into my form window. please guide me how can i do that?
richTextBox should be used for this purpose?
Thanks.
|
|
|
|
|
Well, I guess you could alway put a Web Browser control in your form
that opens the XML file you need displaying.
I think that would work...
Or you could always load it up in a treeview.
That's about all the ideas I have at the moment, only on my fifth coffee,
brain is still slow...
LoneFerret
Cross my heart, smack me dead...stick a lobster on my head.
|
|
|
|
|
Thank you dear LoneFerret
I think your brain is quite fast as compare to mine
actually i am new to C# using VS.Net 2003. I want to embed Web Browser Control but don't know how. Please tell me how i can do that.
Thanksssss.
|
|
|
|
|
Drop it on the form from the toolbox.
|
|
|
|