Przejdź do głównej zawartości

Toggle Vibrate & Ring

Toggle VibraOrRing
cab installation for WM 6.0:
XDA Thread...

c# how to toggle Vibra and Ring On ? simple... use this code :)

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace toggleVibrateSound
{
class Program
{
private enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

private enum SoundType
{
On = 0,
File = 1,
Vibrate = 2,
None = 3
}

private struct SNDFILEINFO
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szPathNameNative;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szDisplayNameNative;

public SoundType SstType;
}


[DllImport("aygshell.dll", SetLastError = true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent, ref SNDFILEINFO pSoundFileInfo, bool fSuppressUI);

[DllImport("aygshell.dll", SetLastError = true)]
private static extern uint SndGetSound(SoundEvent seSoundEvent, ref SNDFILEINFO pSoundFileInfo);


public static void SetRingerOn()
{
SNDFILEINFO sfi = new SNDFILEINFO();
sfi.SstType = SoundType.On;
uint ret = SndSetSound(SoundEvent.All, ref sfi, true);
}

public static void GetCurrentSoundType()
{
SNDFILEINFO sfi = new SNDFILEINFO();
uint ret = SndGetSound(SoundEvent.All, ref sfi);
SoundType aa = sfi.SstType;
if (aa == 0) Vibra(); else SetRingerOn();
}

public static void Vibra()
{
SNDFILEINFO sfi = new SNDFILEINFO();
sfi.SstType = SoundType.Vibrate;
uint ret = SndSetSound(SoundEvent.All, ref sfi, true);
}
unsafe static void Main(string[] args)
{
//Vibra(); // set vibra mode on
//SetRingerOn(); // set ringer mode on
GetCurrentSoundType(); // in this case we toggle Vibra and Ring...

}
}
}

cheers... :)

Komentarze

Popularne posty z tego bloga

Angular2 + Moment.js library with Visual Studio 2017 .Net Core 2.0

Hey there! Recently I was facing problem with adding MomentJs library to Angular2 in .net core 2.0 project.  I'm using Visual Studio 2017 15.3.3.  ( https://www.visualstudio.com/pl/thank-you-downloading-visual-studio/?sku=Community&rel=15 ) Create new test project 2. Use Web -> Angular template  3. Compile and run in chrome to check that everything is ok.  4. Edit package.json. At the end of "dependencies" add new line:  "moment": "2.18.1" 5. Edit tsconfig.json file, At "compilerOptions" add: "allowSyntheticDefaultImports": true, 6. Edit home.component.ts and add: import * as moment from 'moment'; and the constructor.     constructor() {         try {             console.log("test");             let now = moment().format('LLLL');             console.log(now);     ...

świat znowu schodzi na psy... Ganguro

Characteristics In ganguro fashion, a deep tan is combined with hair dyed in shades of orange to blonde, or a silver gray known as "high bleached". Black ink is used as eyeliner and white concealer is used as lipstick and eyeshadow. False eyelashes, plastic facial gems, and pearl powder are often added to this. Platform shoes and brightly-colored outfits complete the ganguro look. Also typical of ganguro fashion are tie-dyed sarongs, miniskirts, and lots of bracelets, rings, and necklaces. The deep ganguro tan is in direct conflict with traditional Japanese ideas of feminine beauty. Due to this, as well as their use of slang, unconventional fashion sense, and perceived lack of hygiene, ganguro gals are almost always portrayed negatively by the Japanese media. Fashion magazines like Egg and Cawaii magazine have had a direct influence on the ganguro. Other popular ganguro magazines include Popteen and Ego System. The ganguro culture has evolved its own synchronized dances, call...