document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using Gtk;
  3.  
  4. public partial class MainWindow : Gtk.Window
  5. {
  6.     public MainWindow() : base(Gtk.WindowType.Toplevel)
  7.     {
  8.         Build();
  9.         Initialize();
  10.     }
  11.  
  12.     protected void OnDeleteEvent(object sender, DeleteEventArgs a)
  13.     {
  14.         Application.Quit();
  15.         a.RetVal = true;
  16.     }
  17.  
  18.     private void Initialize()
  19.     {
  20.         String[] values1 = new string[] {
  21.             "USD",
  22.             "EUR",
  23.             "IDR"
  24.         };
  25.         for (var i = 0; i < values1.Length; i++)
  26.         {
  27.             comboBoxFrom.InsertText(i, values1[i]);
  28.             comboBoxTo.InsertText(i, values1[i]);
  29.         }
  30.  
  31.         clear.Clicked += (object obj, EventArgs args) => {
  32.             amount.Text = "";
  33.         };
  34.  
  35.         switchCurrency.Clicked += (object obj, EventArgs args) => {
  36.             int index = Array.FindIndex(values1, row => row == comboBoxFrom.ActiveText);
  37.             int index2 = Array.FindIndex(values1, row => row == comboBoxTo.ActiveText);
  38.             if (index != -1 && index2 != -1)
  39.             {
  40.                 comboBoxTo.Active = index;
  41.                 comboBoxFrom.Active = index2;
  42.             }
  43.  
  44.         };
  45.  
  46.         convert.Clicked += (object obj, EventArgs args) => {
  47.             String from = comboBoxFrom.ActiveText;
  48.             String to = comboBoxTo.ActiveText;
  49.  
  50.             int temporary = Int32.Parse(amount.Text);
  51.  
  52.             if (from == "IDR")
  53.             {
  54.                 switch (to)
  55.                 {
  56.                     case "IDR":
  57.                         {
  58.                             entry2.Text = (temporary * 1).ToString();
  59.                         }
  60.                         break;
  61.                     case "EUR":
  62.                         {
  63.                             entry2.Text = (temporary * 0.000058).ToString();
  64.                         }
  65.                         break;
  66.                     case "USD":
  67.                         {
  68.                             entry2.Text = (temporary * 0.000069).ToString();
  69.                         }
  70.                         break;
  71.                 }
  72.             }
  73.             else if (from == "EUR")
  74.             {
  75.                 switch (to)
  76.                 {
  77.                     case "IDR":
  78.                         {
  79.                             entry2.Text = (temporary * 17133.89).ToString();
  80.                         }
  81.                         break;
  82.                     case "EUR":
  83.                         {
  84.                             entry2.Text = (temporary * 1).ToString();
  85.                         }
  86.                         break;
  87.                     case "USD":
  88.                         {
  89.                             entry2.Text = (temporary * 1.19).ToString();
  90.                         }
  91.                         break;
  92.                 }
  93.             }
  94.             else
  95.             {
  96.                 switch (to)
  97.                 {
  98.                     case "IDR":
  99.                         {
  100.                             entry2.Text = (temporary * 14434.25).ToString();
  101.                         }
  102.                         break;
  103.                     case "EUR":
  104.                         {
  105.                             entry2.Text = (temporary * 0.84).ToString();
  106.                         }
  107.                         break;
  108.                     case "USD":
  109.                         {
  110.                             entry2.Text = (temporary * 1).ToString();
  111.                         }
  112.                         break;
  113.                 }
  114.             }
  115.         };
  116.     }
  117. }
  118.  
');