diff --git a/Telefono de rosalia/Program.cs b/Telefono de rosalia/Program.cs index ac84465..d6eb4dc 100644 --- a/Telefono de rosalia/Program.cs +++ b/Telefono de rosalia/Program.cs @@ -1,9 +1,5 @@ using System; -using System.IO; -using System.Linq; -using System.Media; using System.Runtime.InteropServices; -using System.Threading; using System.Windows.Forms; namespace Telefono_de_rosalia @@ -22,10 +18,8 @@ private enum SL_GENUINE_STATE SL_GEN_STATE_LAST = 3 } - [DllImport("Slwga.dll", EntryPoint = "SLIsGenuineLocal", CharSet = CharSet.None, ExactSpelling = false, SetLastError = false, PreserveSig = true, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = false)] + [DllImport("Slwga.dll", EntryPoint = "SLIsGenuineLocal", CharSet = CharSet.None, ExactSpelling = false, SetLastError = false, PreserveSig = true, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = false)][PreserveSig()] private static extern uint SLIsGenuineLocal(ref SLID slid, [In, Out] ref SL_GENUINE_STATE genuineState, IntPtr val3); - [PreserveSig()] - static extern uint SLIsGenuineLocal(ref SLID slid, [In, Out] ref SL_GENUINE_STATE genuineState, IntPtr val3); public static void CheckWindows() { if (!IsGenuineWindows()) @@ -61,18 +55,12 @@ private static bool IsGenuineWindows() } } - [DllImport("winmm.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] - public static extern uint waveOutGetNumDevs(); - - [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] - private static extern bool SetProcessDPIAware(); - [DllImport("winmm.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern uint waveOutGetNumDevs(); [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern bool SetProcessDPIAware(); [STAThread] - static void Main() + private static void Main() { GenuineWindowsDetector.CheckWindows(); @@ -82,22 +70,16 @@ static void Main() Environment.Exit(0); } - double[] freqs = { 697, 770, 852, 941 }; - double[] freqs2 = { 1209, 1336, 1477 }; - - for (int i = 0; i < freqs.Length; i++) + /*for (int i = 0; i < horizontalFreq.Length; i++) { - for (int e = 0; e < freqs2.Length; e++) + for (int e = 0; e < verticalFreq.Length; e++) { - using (var tone = GenerateTone(0.25, freqs[i], freqs2[e])) + using (var tone = GenerateTone(0.8, horizontalFreq[i], verticalFreq[e])) { - using (var player = new SoundPlayer(tone)) - { player.PlaySync(); - } } } - } + }*/ if (waveOutGetNumDevs() == 0) { @@ -112,7 +94,7 @@ static void Main() Application.Run(new RosaliaTelefonoForm()); } - private static Stream GenerateTone(double duration, params double[] frequencies) + /*private static Stream GenerateTone(double duration, params double[] frequencies) { const int sampleRate = 44100; const short bitsPerSample = 16; @@ -137,13 +119,13 @@ private static Stream GenerateTone(double duration, params double[] frequencies) { double t = (double)i / sampleRate; var freqSamples = frequencies.Select(f => (Math.Sin(2 * Math.PI * f * t))); - short sample = (short)(short.MaxValue * freqSamples.Sum() / 2); ; + short sample = (short)(short.MaxValue * freqSamples.Sum() / 2); writer.Write(sample); } writer.Flush(); stream.Position = 0; return stream; - } + }*/ } } \ No newline at end of file diff --git a/Telefono de rosalia/Resources/Nokiarosalico b/Telefono de rosalia/Resources/Nokiarosalico deleted file mode 100644 index 9763671..0000000 Binary files a/Telefono de rosalia/Resources/Nokiarosalico and /dev/null differ diff --git a/Telefono de rosalia/Resources/Nokiarosalico.png b/Telefono de rosalia/Resources/Nokiarosalico.png index 4f5576b..35e1972 100644 Binary files a/Telefono de rosalia/Resources/Nokiarosalico.png and b/Telefono de rosalia/Resources/Nokiarosalico.png differ diff --git a/Telefono de rosalia/Resources/NokiarosalicoOcup b/Telefono de rosalia/Resources/NokiarosalicoOcup deleted file mode 100644 index f247e98..0000000 Binary files a/Telefono de rosalia/Resources/NokiarosalicoOcup and /dev/null differ diff --git a/Telefono de rosalia/Resources/NokiarosalicoOcupado.old.png b/Telefono de rosalia/Resources/NokiarosalicoOcupado.old.png new file mode 100644 index 0000000..bfd1f0e Binary files /dev/null and b/Telefono de rosalia/Resources/NokiarosalicoOcupado.old.png differ diff --git a/Telefono de rosalia/Resources/NokiarosalicoOcupado.png b/Telefono de rosalia/Resources/NokiarosalicoOcupado.png index de72c93..05d30f9 100644 Binary files a/Telefono de rosalia/Resources/NokiarosalicoOcupado.png and b/Telefono de rosalia/Resources/NokiarosalicoOcupado.png differ diff --git a/Telefono de rosalia/Resources/TararaTaratata.wav b/Telefono de rosalia/Resources/TararaTaratata.wav index e4648f5..adddfed 100644 Binary files a/Telefono de rosalia/Resources/TararaTaratata.wav and b/Telefono de rosalia/Resources/TararaTaratata.wav differ diff --git a/Telefono de rosalia/RosaliaTelefonoForm.Designer.cs b/Telefono de rosalia/RosaliaTelefonoForm.Designer.cs index c8385e4..bd9aece 100644 --- a/Telefono de rosalia/RosaliaTelefonoForm.Designer.cs +++ b/Telefono de rosalia/RosaliaTelefonoForm.Designer.cs @@ -1,4 +1,5 @@ -using System.Windows.Forms; +using System.Drawing; +using System.Windows.Forms; namespace Telefono_de_rosalia { @@ -68,9 +69,10 @@ private void InitializeComponent() this.NullButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.NullButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.NullButton.ForeColor = System.Drawing.Color.Transparent; - this.NullButton.Location = new System.Drawing.Point(90, 380); + this.NullButton.Location = new System.Drawing.Point(54, 310); + this.NullButton.Margin = new System.Windows.Forms.Padding(2); this.NullButton.Name = "NullButton"; - this.NullButton.Size = new System.Drawing.Size(49, 54); + this.NullButton.Size = new System.Drawing.Size(51, 44); this.NullButton.TabIndex = 1; this.NullButton.UseVisualStyleBackColor = false; this.NullButton.Click += new System.EventHandler(this.NullButton_Click); @@ -80,9 +82,10 @@ private void InitializeComponent() this.InvisibleButton.BackColor = System.Drawing.Color.Transparent; this.InvisibleButton.FlatAppearance.BorderSize = 0; this.InvisibleButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.InvisibleButton.Location = new System.Drawing.Point(331, 38); + this.InvisibleButton.Location = new System.Drawing.Point(248, 31); + this.InvisibleButton.Margin = new System.Windows.Forms.Padding(2); this.InvisibleButton.Name = "InvisibleButton"; - this.InvisibleButton.Size = new System.Drawing.Size(28, 28); + this.InvisibleButton.Size = new System.Drawing.Size(21, 23); this.InvisibleButton.TabIndex = 0; this.InvisibleButton.UseVisualStyleBackColor = false; // @@ -94,18 +97,21 @@ private void InitializeComponent() this.Number_1_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_1_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_1_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_1_Button.Location = new System.Drawing.Point(81, 458); + this.Number_1_Button.Location = new System.Drawing.Point(50, 372); + this.Number_1_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_1_Button.Name = "Number_1_Button"; - this.Number_1_Button.Size = new System.Drawing.Size(49, 39); + this.Number_1_Button.Size = new System.Drawing.Size(48, 30); this.Number_1_Button.TabIndex = 5; this.Number_1_Button.UseVisualStyleBackColor = false; + this.Number_1_Button.Click += new System.EventHandler(this.Number_1_Button_Click); // // RosaliaDancePictureBox // this.RosaliaDancePictureBox.BackColor = System.Drawing.Color.Transparent; - this.RosaliaDancePictureBox.Location = new System.Drawing.Point(81, 183); + this.RosaliaDancePictureBox.Location = new System.Drawing.Point(50, 149); + this.RosaliaDancePictureBox.Margin = new System.Windows.Forms.Padding(2); this.RosaliaDancePictureBox.Name = "RosaliaDancePictureBox"; - this.RosaliaDancePictureBox.Size = new System.Drawing.Size(216, 158); + this.RosaliaDancePictureBox.Size = new System.Drawing.Size(173, 128); this.RosaliaDancePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.RosaliaDancePictureBox.TabIndex = 2; this.RosaliaDancePictureBox.TabStop = false; @@ -120,8 +126,9 @@ private void InitializeComponent() this.TelefonoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.TelefonoPictureBox.Image = global::Telefono_de_rosalia.Properties.Resources.Nokiarosalico; this.TelefonoPictureBox.Location = new System.Drawing.Point(0, 0); + this.TelefonoPictureBox.Margin = new System.Windows.Forms.Padding(2); this.TelefonoPictureBox.Name = "TelefonoPictureBox"; - this.TelefonoPictureBox.Size = new System.Drawing.Size(371, 704); + this.TelefonoPictureBox.Size = new System.Drawing.Size(278, 572); this.TelefonoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.TelefonoPictureBox.TabIndex = 0; this.TelefonoPictureBox.TabStop = false; @@ -138,11 +145,13 @@ private void InitializeComponent() this.Number_2_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_2_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_2_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_2_Button.Location = new System.Drawing.Point(160, 469); + this.Number_2_Button.Location = new System.Drawing.Point(113, 381); + this.Number_2_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_2_Button.Name = "Number_2_Button"; - this.Number_2_Button.Size = new System.Drawing.Size(58, 37); + this.Number_2_Button.Size = new System.Drawing.Size(52, 30); this.Number_2_Button.TabIndex = 6; this.Number_2_Button.UseVisualStyleBackColor = false; + this.Number_2_Button.Click += new System.EventHandler(this.Number_2_Button_Click); // // Number_3_Button // @@ -152,11 +161,13 @@ private void InitializeComponent() this.Number_3_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_3_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_3_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_3_Button.Location = new System.Drawing.Point(248, 458); + this.Number_3_Button.Location = new System.Drawing.Point(181, 372); + this.Number_3_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_3_Button.Name = "Number_3_Button"; - this.Number_3_Button.Size = new System.Drawing.Size(58, 37); + this.Number_3_Button.Size = new System.Drawing.Size(60, 32); this.Number_3_Button.TabIndex = 7; this.Number_3_Button.UseVisualStyleBackColor = false; + this.Number_3_Button.Click += new System.EventHandler(this.Number_3_Button_Click); // // Number_4_Button // @@ -166,11 +177,13 @@ private void InitializeComponent() this.Number_4_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_4_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_4_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_4_Button.Location = new System.Drawing.Point(81, 504); + this.Number_4_Button.Location = new System.Drawing.Point(50, 410); + this.Number_4_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_4_Button.Name = "Number_4_Button"; - this.Number_4_Button.Size = new System.Drawing.Size(58, 37); + this.Number_4_Button.Size = new System.Drawing.Size(55, 38); this.Number_4_Button.TabIndex = 8; this.Number_4_Button.UseVisualStyleBackColor = false; + this.Number_4_Button.Click += new System.EventHandler(this.Number_4_Button_Click); // // Number_5_Button // @@ -181,11 +194,13 @@ private void InitializeComponent() this.Number_5_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_5_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_5_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_5_Button.Location = new System.Drawing.Point(161, 514); + this.Number_5_Button.Location = new System.Drawing.Point(113, 415); + this.Number_5_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_5_Button.Name = "Number_5_Button"; - this.Number_5_Button.Size = new System.Drawing.Size(58, 37); + this.Number_5_Button.Size = new System.Drawing.Size(56, 39); this.Number_5_Button.TabIndex = 9; this.Number_5_Button.UseVisualStyleBackColor = false; + this.Number_5_Button.Click += new System.EventHandler(this.Number_5_Button_Click); // // Number_6_Button // @@ -195,11 +210,13 @@ private void InitializeComponent() this.Number_6_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_6_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_6_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_6_Button.Location = new System.Drawing.Point(248, 504); + this.Number_6_Button.Location = new System.Drawing.Point(181, 414); + this.Number_6_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_6_Button.Name = "Number_6_Button"; - this.Number_6_Button.Size = new System.Drawing.Size(58, 37); + this.Number_6_Button.Size = new System.Drawing.Size(51, 30); this.Number_6_Button.TabIndex = 10; this.Number_6_Button.UseVisualStyleBackColor = false; + this.Number_6_Button.Click += new System.EventHandler(this.Number_6_Button_Click); // // Number_7_Button // @@ -209,11 +226,13 @@ private void InitializeComponent() this.Number_7_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_7_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_7_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_7_Button.Location = new System.Drawing.Point(81, 556); + this.Number_7_Button.Location = new System.Drawing.Point(54, 452); + this.Number_7_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_7_Button.Name = "Number_7_Button"; - this.Number_7_Button.Size = new System.Drawing.Size(58, 37); + this.Number_7_Button.Size = new System.Drawing.Size(51, 30); this.Number_7_Button.TabIndex = 11; this.Number_7_Button.UseVisualStyleBackColor = false; + this.Number_7_Button.Click += new System.EventHandler(this.Number_7_Button_Click); // // Number_8_Button // @@ -223,11 +242,13 @@ private void InitializeComponent() this.Number_8_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_8_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_8_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_8_Button.Location = new System.Drawing.Point(161, 567); + this.Number_8_Button.Location = new System.Drawing.Point(121, 461); + this.Number_8_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_8_Button.Name = "Number_8_Button"; - this.Number_8_Button.Size = new System.Drawing.Size(58, 37); + this.Number_8_Button.Size = new System.Drawing.Size(44, 30); this.Number_8_Button.TabIndex = 12; this.Number_8_Button.UseVisualStyleBackColor = false; + this.Number_8_Button.Click += new System.EventHandler(this.Number_8_Button_Click); // // Number_9_Button // @@ -237,11 +258,13 @@ private void InitializeComponent() this.Number_9_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_9_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_9_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_9_Button.Location = new System.Drawing.Point(239, 547); + this.Number_9_Button.Location = new System.Drawing.Point(182, 447); + this.Number_9_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_9_Button.Name = "Number_9_Button"; - this.Number_9_Button.Size = new System.Drawing.Size(58, 46); + this.Number_9_Button.Size = new System.Drawing.Size(44, 37); this.Number_9_Button.TabIndex = 13; this.Number_9_Button.UseVisualStyleBackColor = false; + this.Number_9_Button.Click += new System.EventHandler(this.Number_9_Button_Click); // // Number_0_Button // @@ -251,11 +274,13 @@ private void InitializeComponent() this.Number_0_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_0_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_0_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_0_Button.Location = new System.Drawing.Point(161, 610); + this.Number_0_Button.Location = new System.Drawing.Point(113, 496); + this.Number_0_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_0_Button.Name = "Number_0_Button"; - this.Number_0_Button.Size = new System.Drawing.Size(58, 37); + this.Number_0_Button.Size = new System.Drawing.Size(52, 37); this.Number_0_Button.TabIndex = 14; this.Number_0_Button.UseVisualStyleBackColor = false; + this.Number_0_Button.Click += new System.EventHandler(this.Number_0_Button_Click); // // Number_Asterisk_Button // @@ -265,11 +290,13 @@ private void InitializeComponent() this.Number_Asterisk_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_Asterisk_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_Asterisk_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_Asterisk_Button.Location = new System.Drawing.Point(81, 599); + this.Number_Asterisk_Button.Location = new System.Drawing.Point(61, 489); + this.Number_Asterisk_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_Asterisk_Button.Name = "Number_Asterisk_Button"; - this.Number_Asterisk_Button.Size = new System.Drawing.Size(66, 39); + this.Number_Asterisk_Button.Size = new System.Drawing.Size(44, 35); this.Number_Asterisk_Button.TabIndex = 15; this.Number_Asterisk_Button.UseVisualStyleBackColor = false; + this.Number_Asterisk_Button.Click += new System.EventHandler(this.Number_Asterisk_Button_Click); // // Number_Hashtag_Button // @@ -279,18 +306,20 @@ private void InitializeComponent() this.Number_Hashtag_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.Number_Hashtag_Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Number_Hashtag_Button.ForeColor = System.Drawing.Color.Transparent; - this.Number_Hashtag_Button.Location = new System.Drawing.Point(239, 599); + this.Number_Hashtag_Button.Location = new System.Drawing.Point(176, 490); + this.Number_Hashtag_Button.Margin = new System.Windows.Forms.Padding(2); this.Number_Hashtag_Button.Name = "Number_Hashtag_Button"; - this.Number_Hashtag_Button.Size = new System.Drawing.Size(58, 46); + this.Number_Hashtag_Button.Size = new System.Drawing.Size(51, 37); this.Number_Hashtag_Button.TabIndex = 16; this.Number_Hashtag_Button.UseVisualStyleBackColor = false; + this.Number_Hashtag_Button.Click += new System.EventHandler(this.Number_Hashtag_Button_Click); // // RosaliaTelefonoForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(371, 704); + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(278, 572); this.ControlBox = false; this.Controls.Add(this.Number_Hashtag_Button); this.Controls.Add(this.Number_Asterisk_Button); @@ -310,13 +339,14 @@ private void InitializeComponent() this.Controls.Add(this.InvisibleButton); this.Cursor = System.Windows.Forms.Cursors.Default; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RosaliaTelefonoForm"; this.ShowInTaskbar = false; this.Text = "Telefono de rosalia"; this.TopMost = true; - this.TransparencyKey = System.Drawing.SystemColors.Control; + this.TransparencyKey = System.Drawing.Color.White; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RosaliaTelefonoForm_FormClosing); this.Load += new System.EventHandler(this.RosaliaTelefonoForm_Load); this.Shown += new System.EventHandler(this.RosaliaTelefonoForm_Shown); diff --git a/Telefono de rosalia/RosaliaTelefonoForm.cs b/Telefono de rosalia/RosaliaTelefonoForm.cs index 23a15a7..e48e17c 100644 --- a/Telefono de rosalia/RosaliaTelefonoForm.cs +++ b/Telefono de rosalia/RosaliaTelefonoForm.cs @@ -22,6 +22,8 @@ public RosaliaTelefonoForm() this.ShowInTaskbar = false; + Console.WriteLine(SystemColors.Control); + InvisibleButton.FlatStyle = FlatStyle.Flat; InvisibleButton.BackColor = Color.Transparent; InvisibleButton.FlatAppearance.MouseDownBackColor = Color.Transparent; @@ -52,11 +54,7 @@ private async void NumbersButton_Click(object sender, EventArgs e) { Console.WriteLine("Button clicked " + ((Button)sender).Name.ToString()); - if (callAnswered) - { - Task.Run(() => Beep(1209, 200)); - Task.Run(() => Beep(697, 200)); - } + Shake(5, 1, 2); } private bool callAnswered = false; @@ -66,35 +64,42 @@ private void RosaliaTelefonoForm_Shown(object sender, EventArgs e) this.Refresh(); ConfigForm(new List