Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
AnswerRe: Store persistent data Pin
ZurdoDev7-Oct-16 5:12
professionalZurdoDev7-Oct-16 5:12 
PraiseRe: Store persistent data Pin
Eddy Vluggen7-Oct-16 11:47
professionalEddy Vluggen7-Oct-16 11:47 
AnswerRe: Store persistent data Pin
Abhinav S7-Oct-16 20:23
Abhinav S7-Oct-16 20:23 
GeneralRe: Store persistent data Pin
sunsher9-Oct-16 16:26
sunsher9-Oct-16 16:26 
GeneralRe: Store persistent data Pin
Mycroft Holmes9-Oct-16 17:24
professionalMycroft Holmes9-Oct-16 17:24 
GeneralRe: Store persistent data Pin
sunsher10-Oct-16 0:16
sunsher10-Oct-16 0:16 
GeneralRe: Store persistent data Pin
Mycroft Holmes10-Oct-16 12:37
professionalMycroft Holmes10-Oct-16 12:37 
QuestionExecuting PS1 file to perform a task in Exchange Pin
choppol6-Oct-16 12:29
choppol6-Oct-16 12:29 
AnswerRe: Executing PS1 file to perform a task in Exchange Pin
Eddy Vluggen7-Oct-16 11:51
professionalEddy Vluggen7-Oct-16 11:51 
QuestionCan someone explain this WPF oddity? Pin
Foothill6-Oct-16 9:47
professionalFoothill6-Oct-16 9:47 
AnswerRe: Can someone explain this WPF oddity? PinPopular
Richard Deeming6-Oct-16 11:44
mveRichard Deeming6-Oct-16 11:44 
GeneralRe: Can someone explain this WPF oddity? Pin
Mycroft Holmes6-Oct-16 12:41
professionalMycroft Holmes6-Oct-16 12:41 
GeneralRe: Can someone explain this WPF oddity? Pin
Foothill7-Oct-16 3:15
professionalFoothill7-Oct-16 3:15 
QuestionEventRecord's FormatDescription() is super slow Pin
_PitrakSarkar_4-Oct-16 20:05
_PitrakSarkar_4-Oct-16 20:05 
AnswerRe: EventRecord's FormatDescription() is super slow Pin
Pete O'Hanlon4-Oct-16 23:29
mvePete O'Hanlon4-Oct-16 23:29 
GeneralRe: EventRecord's FormatDescription() is super slow Pin
_PitrakSarkar_5-Oct-16 0:07
_PitrakSarkar_5-Oct-16 0:07 
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 

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.