I saw this extension to Serilog that proides writing logs to text box on WinForms..
https://github.com/umairsyed613/Serilog.Sinks.WinForms
What I did not understand, is how I decide on the textbox that I want to write to.
Or there is another step to do that I didn't noticed?
I had the same issue. Here are the steps to use it:
download the library "Install-Package Serilog.Sinks.WinForms" or use NuGet. I used VS2019 package manager console to install mine.
This part i missed and it took me a while to get. You need to add "SeriLog Control" from the toolbox menu. So search toolbox menu and add the gidLog1 control.
Configure your logger (i did mine in the Form load event.)
Log.Logger = new LoggerConfiguration()
.WriteToGridView()
.CreateLogger();
Perform/trigger a log action, you can add to you form load event too eg. below.
Log.Information("Application Started");
Related
I have developed app using Codename one in that I am using FingerprintScanner.cn1 library for Fingerprint functionality.when I calls Fingerprint.scanFingerprint() It scans the finger print and shows the result but at that time default dialog coming with fingerprint icon/image at the begining .I dont want to show that dialog and fingerprint image.What should I do for that?
Thanks in advance
A dialog is shown by default on iOS except for the new iOS 11 which is still in beta stage.
On Android, the same functionality is simulated by showing a Codename One dialog.
If you want to control Android UI only, you can fork the FingerprintScanner Source code on GitHub and modify this class where the Dialog is shown. Then, clean and build to generate a cn1Lib which you can use in your project.
Edit:
I've added a method that allows you to specify you don't want to show users a dialog on Android.
To update, right click your project and go to Codename One -> Codename One Settings -> Extensions, search for FingerPrint and update the extension. If the "Update" is not showing, try again later or you could just download the latest version directly to your lib folder from here.
Right click your project again and go to Codename One -> Refresh cn1lib files
Now change your declaration method to something like this:
Fingerprint.scanFingerprint("Use your finger print to unlock AppName.", value -> {
Log.p("Scan successfull!");
}, (sender, err, errorCode, errorMessage) -> {
Log.p("Scan Failed!");
}, false); //note the false argument
I need app.config automatically database informations setting according to a user control ..
Normally, we are setting up database informations in app.config. But when standart users run this program, it must login database setting on a interface . so, they should enter their database informations . not in app.config.
how should I do this?
if you are using visual studio for Windows Form Application then you can create Settings to store your different type of values in it. You can write and read settings programmatically like this.
//To Write
Properties.Settings.Default.DatabaseName = textBox1.Text;
Properties.Settings.Default.Save();
//To Read
textBox1.Text = Properties.Settings.Default.DatabaseName;
You can find article about User's Settings on MSDN
Edited
Full Example given here:
http://www.c-sharpcorner.com/UploadFile/5089e0/create-single-connection-string-for-all-windows-form-in-net/
If you are developing using DevExpress XAF, you can display a standard Windows form just before the application startup. Technically, this form can be invoked via the ShowDialog method before the winApplication.Setup() call in the Main routine (of course, the invocation must be done only if no user settings are saved yet). Once you display this dialog and gather user input, update the winApplication.ConnectionString property accordingly (see also).
Another more complex solution is to embed this database settings UI into the logon form as described at https://www.devexpress.com/Support/Center/Example/Details/E1344.
Do not hesitate to contact the DevExpress support team if you want to further discuss the implementation of this task.
I'm really stucked at my final stage of coding. I've created a custom button in lead section and i'm calling custom setting url in javascript code.
It works very well in my developer organization but it fails when I installs this in other developer organization.
Here is the code for your reference;
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}
var uname = encodeURI('{!$Setup.UserDetails__c.UName__c}');
var ukey= encodeURI('{!$Setup.UserDetails__c.Sha1Key__c}');
try{
var rurl= escape('/handleapprequest?email={!Lead.Email}&fname ={!Lead.FirstName}&lastname={!Lead.LastName}&company={!Lead.Company}');
window.open('{!$Setup.UserDetails__c.Url__c}login/' + uname + '/'+ ukey +'?returnurl='+rurl, 'Send Email', 'height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)
}catch(err)
{alert(err);}
When I install my package to different developer organization, the button which executes onClick javascript, thows an exception 'A problem with the OnClick JavaScript for this button or link was encountered: Field Setup.UserDetails_c.UName_c does not exists check spelling'
Please, let me know what is going wrong here? I've already created Beta package and I can not change or remove code from my developer org.
Thanks a lot.
Firstly, you should check whether you actually included the Custom Setting in your package. If you don't do that then it just won't exist in the new org.
Even if you do have the Custom Setting in the package, you still have to put a value in it in the destination org. Packages include metadata only, not data, and so you'll have to add a row to this custom setting for your button to pick it up. You can do this manually in the destination org, or you can do it automatically with a post-install trigger. Even if you've got a beta managed package, you can still add objects and code to it, by the way.
I have an application written in c that has no dialog box.
However, when you right click the icon you get a floating menu and from there you can choose the about option. This will open an about dialog box. I have inside a link to some webpage, that can be pressed- that will open a browser and navigate to the URL. However, I am unable to make that URL appear as a hyperlink (all that GUI related work is done via the resource .rc file only).
Does anyone know how to color that link in blue and underline to make it appear as a hyperlink through resource script only?
Thank you
I haven't tried this myself but it looks like you can use the CONTROL statement in the resource script to include the SysLink class (which requires common controls v6/Win XP, and will therefore mean you also need a manifest in your application). For more details see http://msdn.microsoft.com/en-us/library/bb760706%28VS.85%29.aspx.
However, you will need to handle the notification from the SysLink control in order to launch the browser and you would need to call InitCommonControlsEx() before the dialog resource is used. That might stop all your GUI work being done by the rc file.
Another alternative would be to register a new window class, subclass from the SysLink control and customise the window message that would normally send the click notification to the parent in order to launch the browser. You could then use your custom class name in a CONTROL statement in the rc file. You still have more work to do but all the GUI handling would be done for you.
I have written a winform application in C#. When I run the program for some functionality it required admin permission. After Installation If I set the .exe file to run as admin manually (by clicking right mouse button on .exe file) then my program run perfectly.
Now I need user not to set the run as admin property after installation by clicking right mouse button. I need to set this programaticaly somewhere in the code that user no need to bother about this. This specific problem is only arise for Windows Vista. Can anyone help me out?
You need to add a manifest to the app that specifies it require admin privileges. Read more on MSDN.
Update: You can add a manifest to your project by right-clicking on the project and selecting Add / New Item / Application Manifest File. This will add a new file called app.manifest to your project and will reference it from the project properties, in the Manifest dropdown on the Application tab. The default manifest template even has a nice comments on how exactly to change the required UAC execution level.
You need to specify the requestedExecutionLevel in the manifest.
See here for a detailed explanation:
http://petesbloggerama.blogspot.com/2007/04/making-your-assembly-run-as.html