Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: EventRecord's FormatDescription() is super slow Pin
Lucas Alvarez Lacasa21-Nov-18 8:10
Lucas Alvarez Lacasa21-Nov-18 8:10 
QuestionC# to C++ SEND AND RECIEVED Pin
Jarlo Belledo4-Oct-16 2:14
Jarlo Belledo4-Oct-16 2:14 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
OriginalGriff4-Oct-16 2:28
mveOriginalGriff4-Oct-16 2:28 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
NotPolitcallyCorrect4-Oct-16 2:45
NotPolitcallyCorrect4-Oct-16 2:45 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
Eddy Vluggen4-Oct-16 3:01
professionalEddy Vluggen4-Oct-16 3:01 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
Pete O'Hanlon4-Oct-16 3:04
mvePete O'Hanlon4-Oct-16 3:04 
GeneralRe: C# to C++ SEND AND RECIEVED PinPopular
Mycroft Holmes4-Oct-16 12:50
professionalMycroft Holmes4-Oct-16 12:50 
QuestionRunning Powershell scripts in C# fails/no effect Pin
me@dagsunde.com3-Oct-16 22:35
professionalme@dagsunde.com3-Oct-16 22:35 
I know this isn't a Powershell forum, but the question is about PS in C#..

I have the following Powershell, that clears my languagebar, Setting Norwegian language. Adds Norwegian Apple Keyboard, removes, then Adds back to the end normal Norwegian keyboard:
$li = New-WinUserLanguageList "nb-NO";
$li[0].InputMethodTips.Add("0414:A0000414");
$li[0].InputMethodTips.Remove("0414:00000414");
Set-WinUserLanguageList $li -Force
$li = Get-WinUserLanguageList
$li[0].InputMethodTips.Add("0414:00000414");
Set-WinUserLanguageList $li -Force


This works Peachy when run from the powershell commandline. It updates the Language bar, and
set the Apple keyboard as default.

But when embedding it in C# like this:
C#
string script = "";
script += "$li = New-WinUserLanguageList nb-NO;";
script += "$li[0].InputMethodTips.Add(\"0414:A0000414\");";
script += "$li[0].InputMethodTips.Remove(\"0414:00000414\");";
script += "Set-WinUserLanguageList $li -Force;";
script += "$li[0].InputMethodTips.Add(\"0414:00000414\");";
script += "Set-WinUserLanguageList $li -Force;";

using ( PowerShell ps = PowerShell.Create() ) {

    ps.AddScript( script );
    var result = ps.Invoke();

    foreach ( var item in result ) {
        //Nothing.
    }
}


The language bar does not get updated, although the language IS switched to Norwegian...

Is there any limitations on what kind of ps-scripts you can embed in C#?
(Both the script and the c# code runs as me/current user)...

TIA.

--
Dag.
AnswerRe: Running Powershell scripts in C# fails/no effect Pin
Pete O'Hanlon3-Oct-16 23:44
mvePete O'Hanlon3-Oct-16 23:44 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com4-Oct-16 0:20
professionalme@dagsunde.com4-Oct-16 0:20 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com3-Oct-16 23:52
professionalme@dagsunde.com3-Oct-16 23:52 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
Pete O'Hanlon4-Oct-16 0:34
mvePete O'Hanlon4-Oct-16 0:34 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com4-Oct-16 1:52
professionalme@dagsunde.com4-Oct-16 1:52 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
Pete O'Hanlon4-Oct-16 2:03
mvePete O'Hanlon4-Oct-16 2:03 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com4-Oct-16 20:29
professionalme@dagsunde.com4-Oct-16 20:29 
Questionhow to display a value using delegate ? Pin
forte743-Oct-16 15:56
forte743-Oct-16 15:56 
AnswerRe: how to display a value using delegate ? Pin
Midi_Mick3-Oct-16 17:51
professionalMidi_Mick3-Oct-16 17:51 
AnswerRe: how to display a value using delegate ? Pin
Simon_Whale3-Oct-16 23:35
Simon_Whale3-Oct-16 23:35 
AnswerRe: how to display a value using delegate ? Pin
Sunil Jatolia4-Oct-16 21:06
professionalSunil Jatolia4-Oct-16 21:06 
QuestionGrammar checker Web server - MultiThreaded Application Pin
nqioweryuadfge3-Oct-16 1:57
nqioweryuadfge3-Oct-16 1:57 
GeneralRe: Grammar checker Web server - MultiThreaded Application Pin
Richard MacCutchan3-Oct-16 2:02
mveRichard MacCutchan3-Oct-16 2:02 
GeneralRe: Grammar checker Web server - MultiThreaded Application Pin
nqioweryuadfge3-Oct-16 2:13
nqioweryuadfge3-Oct-16 2:13 
GeneralRe: Grammar checker Web server - MultiThreaded Application Pin
Richard MacCutchan3-Oct-16 2:17
mveRichard MacCutchan3-Oct-16 2:17 
GeneralRe: Grammar checker Web server - MultiThreaded Application Pin
nqioweryuadfge3-Oct-16 2:19
nqioweryuadfge3-Oct-16 2:19 
AnswerRe: Grammar checker Web server - MultiThreaded Application Pin
Pete O'Hanlon3-Oct-16 2:06
mvePete O'Hanlon3-Oct-16 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.