Last night I wanted to start a new project, but with a strange Error I face !!!
If anyone has worked with Translation API, please help!
The Error Tip is :
The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
and My Codes are Here too.
private void Form1_Load(object sender, EventArgs e)
{
TranslationClient cli = TranslationClient.Create();
var word = cli.TranslateText("hello","fa");
MessageBox.Show(word.TranslatedText.ToString());
}
Related
Is there any possibility to access the automatic answering function of Outlook out of my humble WinFormsApp (C#)? To activate it directly out of my App for the time of vacations e.g.
Really appreciate any ideas!
That's what i have but C# doesn't accept the last line:
private void Btn_Click(object sender, EventArgs e)
{
var OLApp = new Outlook.Application();
object OLAssistent = OLApp.AnswerWizard();
}
First of all, the AnswerWizard property is deprecated. Here is what MSDN documentation states:
This object, member, or enumeration is deprecated and is not intended to be used in your code.
Instead, you may consider using EWS if you deal with Exchange accounts or Graph API in case of Office365 accounts configured in Outlook.
after few days of searching and investigating the problem, I finnaly decided to ask the question over here.
In the beginning I want to apologize for my english, it's not so well as it should be, so hope, you'll understand the question well :).
I have a problem when using File.Copy in ASP.NET to summarize the problem - it always says, that I don't have the permission to access the folder defined in "pathFrom". (the only way how the code works is, when I run it in my Visual Studio in debugger), after I upload it on web server, it stops working.
CODE:
protected void buttonclick(object sender, Eventargs e){
string pathFrom = "\\\\sqlSRV\\folder1\\thisOne.txt";
string pathTo = "\\\\webSRV\\folder2\\overHere.txt";
string directory = "\\\\sqlSRV\\folder2";
if (Directory.Exists(directory))
{
try
{
File.Copy(pathFrom, pathTo, true);
}
catch (FileNotFoundException)
{
Lab0.Text = "Not found.";
}
catch (FileLoadException)
{
Lab0.Text = "Cant open.";
}
}
The servers are in the same domain.
Shared folders does have ALL permissions for sqlSRV$ and webSRV$, NETWORK SERVICE, IIS_WPG even for group Everyone (just for testing right now)
we don't want to use impersonate and write the username and password into the code due to security
everything is on our LAN
running IIS10
In the old days we had similiar function in ActiveX, where it all worked (because it knew which user was running the code).
Can anyone, please, help?
Thanks a lot
I'm trying to set a very simple WPF application that will only pull a local HTML page that is a live
and functioning as expected, hosted in our work place.
we have no internet connection within the LAN.
I added succesfully WebView 5.11 (also tried 6.0 with same results) and added the following code:
<WPF:WebView Source="https://localSiteAddress" x:Name="wv" IsPrivateNetworkClientServerCapabilityEnabled="true"/>
this results in a blank page.
I was triyng to do the same through the code CS file and I added the following code:
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
var wv = new WebView();
wv.IsPrivateNetworkClientServerCapabilityEnabled = true;
wv.Source = new Uri("https://localSiteAddress");
grid.Children.Add(wv);
wv.BringIntoView();
}
same behavior
I was trying to access multiple local intranet websites with the same result.
Note: when i use an external PC with Internet connection i nanage to access websites
Anyone pelase help :) any suggestion will be so welcome ... I wasted 48 hours already:)
Thanks
NOTE: The "possible duplicate" question refers to a totally and complete different theme (refering to visual studio user settings". This question is not related to that at all. Please verify before marking "possible duplicates"
I am trying to save some settings of my program between calls and I did what this tutorial says.
It works very well. A little too well...
To summarize I created settings.settings file. Then in the form closing file, I wrote code to save the settings
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.TheSetting = settingNumber;
Properties.Settings.Default.Save();
}
and in the load function code to retrieve the setting
private void Form1_Load(object sender, EventArgs e)
{
DateTime t = DateTime.Now;
if (Properties.Settings.Default.TheDate.Date == t.Date) //it is today
{
settingNumber = Properties.Settings.Default.TheSetting;
}
else
{
//we start again
settingNumber = 0;
}
textBox1.Text = settingNumber.ToString();
}
I tried and run it several times, now the setting Number is 39.
However, and this is the strange thing this value is not found anywhere. I opened the .exe.config file that is supposed to hold the setting values and they have totally different numbers. Even if I edit them (as in the tutorial) the program still runs with its number.
Where are these setting values stored?
Thanks to user swamy I found the required file.
It was in AppData folder (which is in the corresponding User Folder) then Local, and under the a folder named after the program and the file name is user.config. The path is a really long one
I read that this path can change in other versions
Process: I'm currently developing a Game Launcher through Visual Studio. After being successful with everything so far I have come across "A coding idea" that I just can't figure out how to code.
Attempts:
Base Line (Opens Teamspeak):
private void btnFoxedTs_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(#"C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe");
}
Joining Server (Through IP):
private void btnFoxedTs_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(#"C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe://voice.teamspeak.com:9987");
}
Thrown Error:
Any Ideas???
My Plans: I'm wanting to make the button "Auto-Connect" to the Teamspeak server upon, the "Teamspeak Client" opening. Without the user needing to input a Bookmark, Server IP, Anything like that.
If Possible: If this works, would I be able to include a Teamspeak server password, so when they click the button is "Auto-Connects" with a pre-imputed password (Without the user needing to type a password).
Just use the ts3server:// url to run the TS3 client, you can provide all nessecary parameters there.
Basic example:
System.Diagnostics.Process.Start("ts3server://voice.teamspeak.com?password=serverPassword");
The TeamSpeak client registeres itself for the protocol and will be started by Windows it is invoked. You don't even need to bother with the path to the client.
More parameters are described in the official FAQ.
After going through those posts that #GeraldSchneider gave me, I found found this "ts3server://ts3.hoster.com:9987" Parameter URL used in linking your Teamspeak to a Webpage. After playing around a bit, trying out different methods,
I came up with this code:
private void btnFoxedTs_Click(object sender, EventArgs e)
{
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\Program Files\\TeamSpeak 3 Client\\ts3client_win64.exe";
p.StartInfo.Arguments = "ts3server://voice.teamspeak.com";
p.Start();
}
One thing that I must say, after reading the Teamspeak Forums saying that "Command-Line Parameters are not possible", it feels good to get this working.
What it does:
The Code opens up your 'Teamspeak Client' and 'Auto-Connects' to the server that is implemented. The Server opens up in a "new-tab" (If you are connect to other servers) and joined with your pre-set 'Nickname'.
Disclaimer Note: I used the "Default Teamspeak Server Ip" in this post so my personal Teamspeak isn't displayed.