コード例 #1
0
 public static void Main()
 {
     //TODO: Read settings path from arg or env?
     MainApp ma = new MainApp();
     Application.EnableVisualStyles();
     Application.Run(ma.mv);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: hubris/shaghal
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MainApp app = new MainApp())
     {
         app.Run();
     }
 }
コード例 #3
0
    public static void Main(string[] args)
    {
        if (args.Length < 2)
        {
            Console.WriteLine("usage: sample office-file-1 office-file-2 office-file-3 ...");
            return;
        }
        ManualResetEvent[] doneEvents = new ManualResetEvent[args.Length];
        MainApp[] sbcJobs = new MainApp[args.Length];

        Console.WriteLine("launching {0} tasks...", args.Length);
        for (int i = 0; i < args.Length; i++)
        {
            doneEvents[i] = new ManualResetEvent(false);
            MainApp job = new MainApp(args[i], doneEvents[i]);
            sbcJobs[i] = job;
            ThreadPool.QueueUserWorkItem(job.ThreadProc, i);
        }
        WaitHandle.WaitAll(doneEvents);
        Console.WriteLine("All conversions are finished.");
    }
コード例 #4
0
    internal void ReadBodyAsync(Action finishedReading)
    {
        MainApp.ReadClientBody(this.nginx_request, Marshal.GetFunctionPointerForDelegate(new MainApp.ReadClientBodyCallback(r =>
        {
            string file = MainApp.GetRequestBodyFileName(this.nginx_request);

            /*
             *
             #if PERSIST_TEMP_FILE
             * if(File.Exists("/home/chamo/request.bin")) File.Delete("/home/chamo/request.bin");
             *
             * File.Copy(file,"/home/chamo/request.bin");
             #endif
             * MainApp.WriteNginxLog(string.Format("Temporary Filename = '{0}'",file));
             */
            requestBody = File.OpenRead(file);

            /*if(this.IsMultipart)
             *          {
             *                  string boundary = this.ContentType.Substring(this.ContentType.IndexOf("boundary"));
             *                  string boundaryValue = boundary.Split('=')[1];
             *                  MainApp.WriteNginxLog(string.Format("MultiPart Boundary is '{0}'",boundaryValue));
             *                  multiParts = MultiPartUtil.GetPartsFromBodyStream(this.PostStream,boundaryValue).ToArray();
             *                  Files = (from part in multiParts
             * let contentDisposition = part.Headers["Content-Disposition"]
             * let contentType = part.Headers["Content-Type"]
             * where contentDisposition != null && contentDisposition["filename"] != null select new HttpFile
             * {
             * FileName =contentDisposition["filename"],
             * ContentType = contentType != null ? contentType.Value : string.Empty,
             * Stream = part.Stream
             *                  }).ToArray();
             *
             *          }*/
            if (finishedReading != null)
            {
                finishedReading();
            }
        })));
    }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Forms.Init(this, savedInstanceState);

            var start = int.Parse(Intent.GetStringExtra("open") ?? "0");

            MainApp.LaunchData = Intent.GetStringExtra("data");

            var app = new MainApp(start);

            LoadApplication(app);

            if (Intent.Extras != null)
            {
                AndroidNotificationScheduler.Receive(Intent);
            }
        }
コード例 #6
0
        public String connectToDB(String server, String db, String user, String password)
        {
            string connectionString = null;

            connectionString = "Server=" + server + ";Database=" + db + ";User ID=" + user + ";Password="******"Connecting to the DB: " + connectionString);
            cnn = new SqlConnection(connectionString);
            try
            {
                cnn.Open();
                log.Info("Connection was successful!");
                return("Connection was successful! ");
            }
            catch (Exception ex)
            {
                log.Error("Can not open connection !", ex);
                if (MainApp.GetConsole())
                {
                    MessageBox.Show("Can not open connection ! " + ex);
                }
            }
            return(null);
        }
コード例 #7
0
    static void Main()
    {
        Console.Write("쉼표(,)로 구분하여 두 수를 넣으시오: ");
        string[] strings = Console.ReadLine().Split(',');
        int[]    n       = Array.ConvertAll(strings, s => int.Parse(s));

        MainApp     m      = new MainApp();
        OnjDelegate chain1 = (OnjDelegate)Delegate.Combine(
            new OnjDelegate(MainApp.Plus),
            new OnjDelegate(MainApp.Minus),
            new OnjDelegate(m.Multiplication),
            new OnjDelegate(m.Division)
            );

        chain1(n[0], n[1]);
        Console.WriteLine();

        OnjDelegate chain2 = new OnjDelegate(MainApp.Plus)
                             + new OnjDelegate(MainApp.Minus)
                             + new OnjDelegate(m.Multiplication)
                             + new OnjDelegate(m.Division);

        chain2(n[0], n[1]);
    }
コード例 #8
0
ファイル: NavigationModel.cs プロジェクト: Darina77/Lab1
        internal void Navigate(ModesEnum mode)
        {
            switch (mode)
            {
            case ModesEnum.SignIn:
                _contentWindow.ContentControl.Content = _signInView ?? (_signInView = new SignInView());
                break;

            case ModesEnum.SingUp:
                _contentWindow.ContentControl.Content = _signUpView ?? (_signUpView = new SignUpView());
                break;

            case ModesEnum.Main:
                _contentWindow.ContentControl.Content = _mainView ?? (_mainView = new MainApp());
                break;

            case ModesEnum.History:
                _contentWindow.ContentControl.Content = new History();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }
コード例 #9
0
	public void InitializeComponents(MainApp ma){
		_panel = new FlowLayoutPanel();
		_panel.SuspendLayout();
		_panel.AutoSize = true;
		_panel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
		_panel.WrapContents = true;
		//_panel.BackColor = Color.Blue; // to see the effects of DockStyle.Top uncomment this line
		_panel.Dock = DockStyle.Top;
		
		_buttonArray = new Button[5];
		
		for(int i=0; i<_buttonArray.Length; i++){
			_buttonArray[i] = new Button();
			_buttonArray[i].Text = "Button " + (i+1);
			_buttonArray[i].Click += ma.ButtonClickHandler;
			_panel.Controls.Add(_buttonArray[i]);
		}
		
		this.SuspendLayout();
		this.Controls.Add(_panel);
		
		_panel.ResumeLayout();
		this.ResumeLayout();
	}
コード例 #10
0
    static public void Foo(MainApp a, Object o, String s,
        float f1, double d1, float f2, double d2, float f3, double d3,
        long x1, long x2, long x3, long x4, long x5, long x6,
        sbyte y1, byte y2, short y3, ushort y4, int y5, uint y6, long y7, ulong y8,
        float f4, double d4, float f5, double d5, float f6, double d6) {

        String values =
            a.ToString() + " " +
            o.ToString() + " " +
            s.ToString() + " " +
            f1.ToString() + " " +
            d1.ToString() + " " +
            f2.ToString() + " " +
            d2.ToString() + " " +
            f3.ToString() + " " +
            d3.ToString() + " " +
            x1.ToString() + " " +
            x2.ToString() + " " +
            x3.ToString() + " " +
            x4.ToString() + " " +
            x5.ToString() + " " +
            x6.ToString() + " " +
            y1.ToString() + " " +
            y2.ToString() + " " +
            y3.ToString() + " " +
            y4.ToString() + " " +
            y5.ToString() + " " +
            y6.ToString() + " " +
            y7.ToString() + " " +
            y8.ToString() + " " +
            f4.ToString() + " " +
            d4.ToString() + " " +
            f5.ToString() + " " +
            d5.ToString() + " " +
            f6.ToString() + " " +
            d6.ToString() + " " +
            ".";

        if (values != "MainApp O S 1.3393E+18 5.61788680423607" +
            "E+18 3.258727E+18 9.16789895402191E+18 -3.055988E+18 -4.46137648397179E+18 -5851" +
            "159968668995664 6666931803129677785 -1800446251775719400 5844555569909944241 -52" +
            "81267348037457408 2361696488407452169 104 225 -5552 46649 -1474602824 3693303825" +
            " 591560692012003488 16208348825514708073 5.985838E+18 4.30978217368081E+18 -4.90" +
            "6224E+18 1.29464764673023E+18 -7.168869E+18 1.34929258932224E+18 .")
        {
            Console.WriteLine("static void Foo(...): unexpected values: " + values);
            Fail(20);
        }
    }
コード例 #11
0
    static public void RunTests(MainApp This) {

        String values;

        Struct1 s1 = new Struct1();
        Struct2 s2 = new Struct2();
        Struct3 s3 = new Struct3();
        Struct4 s4 = new Struct4();
        Struct5 s5 = new Struct5();
        Struct6 s6 = new Struct6();
        Struct8 s8 = new Struct8();
        Valuesa v = new Valuesa();
        float f;
        double d;
        Object o;
        String s;
        Enumacek e;

        sbyte p1;
        byte p2;
        short p3;
        ushort p4;
        int p5;
        uint p6;
        long p7;
        ulong p8;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s6.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = This;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        p1 = (sbyte)Randomizer();
        p2 = (byte)Randomizer();
        p3 = (short)Randomizer();
        p4 = (ushort)Randomizer();
        p5 = (int)Randomizer();
        p6 = (uint)Randomizer();
        p7 = (long)Randomizer();
        p8 = (ulong)Randomizer();

        // set all fields
        This._s1 = s1;
        This._s2 = s2;
        This._s3 = s3;
        This._s4 = s4;
        This._s5 = s5;
        This._s6 = s6;
        This._s8 = s8;
        This._v = v;
        This._f = f;
        This._d = d;
        This._o = o;
        This._s = s;
        This._e = e;
        This._p1 = p1;
        This._p2 = p2;
        This._p3 = p3;
        This._p4 = p4;
        This._p5 = p5;
        This._p6 = p6;
        This._p7 = p7;
        This._p8 = p8;

        values = This.ToString();

        if (values != 
            "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 931407168" +
            " 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159779942285264" +
            " -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18" +
            " MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481" +
            " 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1 = This.Foo(p1);
        p2 = This.Foo(p2);
        p3 = This.Foo(p3);
        p4 = This.Foo(p4);
        p5 = This.Foo(p5);
        p6 = This.Foo(p6);
        p7 = This.Foo(p7);
        p8 = This.Foo(p8);

        // verify the values of all fields
        values =
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "-96 114 -32144 34594 -19884190" +
            "08 4093738962 3406623781630010640 2826742804614237570 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        s1 = This.Foo(s2, ref s3, p1, ref p1);
        s2 = This.Foo(ref s4, s3, p3, ref p3);
        s3 = This.Foo(s4, ref s5, p5, ref p5);
        s4 = This.Foo(ref s8, s5, p7, ref p7);
        s5 = This.Foo(s8, ref v, p2, ref p2);
        s6 = This.Foo(s5, ref v, p2, ref p2);
        s8 = This.Foo(ref f, v, p4, ref p4);
        v = This.Foo(f, ref d, p6, ref p6);
        f = This.Foo(ref s1, d, p8, ref p8);
        d = This.Foo(ref s2, s1, s, ref s);

        // verify the values of all fields
        values =
            This.ToString();

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159" +
            "779942285264 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.2129737216" +
            "4627E+18 MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 20468" +
            "69481 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "170 233 145 161 144 249 49 128 137 232 1" +
            "12 25 216 241 192 263746504 217 24 177 0 9 104 225 80 17 7072 -1278944919 567925" +
            "9233286952200 964207834727950401 -272742416 14745 88 -7.848656E+18 3.16790391993" +
            "929E+18 MainApp -5893266573950244255 Hali -16 220 21112 49618 -153164056 1655108" +
            "490 -374121548284004952 17419808404417595330 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1 = This._s1;
        s2 = This._s2;
        s3 = This._s3;
        s4 = This._s4;
        s5 = This._s5;
        s6 = This._s6;
        s8 = This._s8;
        v = This._v;
        f = This._f;
        d = This._d;
        o = This._o;
        s = This._s;
        e = This._e;
        p1 = This._p1;
        p2 = This._p2;
        p3 = This._p3;
        p4 = This._p4;
        p5 = This._p5;
        p6 = This._p6;
        p7 = This._p7;
        p8 = This._p8;

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -90161597799422852" +
            "64 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18 M" +
            "ainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481 1703" +
            "311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        This.Foo(This, "O", "S",
            (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer(),
            (long)Randomizer(), (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
            (long)Randomizer(), (long)Randomizer(),
            (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(), (ushort)Randomizer(),
            (int)Randomizer(), (uint)Randomizer(), (long)Randomizer(), (ulong)Randomizer(),
            (float)Randomizer(), (double)Randomizer(),  (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer());
    }
コード例 #12
0
 public void RolePressed()
 {
     cmd.Action = WerewolfCommand.CommandEnum.GetRoleInformation;
     MainApp.Notify(cmd, this);
 }
コード例 #13
0
 public void PlayBtnPressed()
 {
     cmd.Action = WerewolfCommand.CommandEnum.JoinGame;
     MainApp.Notify(cmd, this);
 }
コード例 #14
0
 public void LeaveBtnPressed()
 {
     StopAllCoroutines();
     cmd.Action = WerewolfCommand.CommandEnum.LeaveGame;
     MainApp.Notify(cmd, this);
 }
コード例 #15
0
        private void addKrigingLayerButton_Click(object sender, EventArgs e, MainApp.Forms.KrigingLayerSelectionFrom fm)
        {
            foreach (var item in fm.LayersItem)
            {
                if (item.isSelected)
                {
                    var krigingField = new InterpolatedFields();
                    krigingField.ZData = item.getZData();
                    krigingField.Field = !string.IsNullOrEmpty(item.Layer.LegendText) ? item.Layer.LegendText : item.Layer.DataSet.Name;
                    krigingField.Image = item.ImagePath;
                    krigingField.PieChartData = item.PieChartData;
                    krigingField.ColorsCategories = Newtonsoft.Json.JsonConvert.SerializeObject(item.ColorsList);

                    fm.Close();


                    var ctrl = new SelectedKrigingItem(krigingField, flowLayoutPanel1.Controls.Count + 1);
                    flowLayoutPanel1.Controls.Add(ctrl);
                }
            }

        }
コード例 #16
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     MainApp m = new MainApp();
 }
コード例 #17
0
	public MenuGUI(MainApp ma, int x, int y, int width, int height){
		this.Bounds = new Rectangle(x, y, width, height);
		this.Text = "MenuGUI Window";
		InitializeComponents(ma);
	}
コード例 #18
0
    public MainApp(MainApp a,
        Struct1 s1, Struct2 s2, Struct3 s3, Struct4 s4, Struct5 s5, Struct8 s8,
        Valuesa v, float f, double d, Object o, String s, Enumacek e) {

        String values =
            a.ToString() + " " +
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            ".";

        if (values != "MainApp 9 104 225 80 57 184 17 160 105 8 65 240" +
            " 153 88 113 64 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236" +
            "865 -9016159779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 M" +
            "ainApp 2212973731230676456 Hali .")
        {
            Console.WriteLine("MainApp(...): unexpected values: " + values);
            Fail(22);
        }
    }
コード例 #19
0
ファイル: Program.cs プロジェクト: felipetofoli/WireMock.Net
 static void Main(params string[] args)
 {
     MainApp.Run();
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: dd86k/0xdd
        static int Main(string[] args)
        {
#if DEBUG
            // Used for debugging within Visual Studio (vshost)
            args = new string[] { "image.jpg" };
            //args = new string[] { "/o", "J", "image.jpg" };
            //args = new string[] { "test.txt" };
            //args = new string[] { "zero" };
#endif

            if (args.Length == 0)
            {
                // Future reminder:
                // New buffer in editing mode if no arguments
                ShowHelp();
                return(0);
            }

            // Defaults
            string entry = args[args.Length - 1];
            MainApp.BytesPerRow = 0;
            MainApp.OffsetView  = OffsetView.Hex;
            bool dump = false;

            for (int i = 0; i < args.Length; ++i)
            {
                switch (args[i])
                {
                case "-o":
                case "/o":
                    switch (args[i + 1][0])
                    {
                    case 'h':
                    case 'H':
                        MainApp.OffsetView = OffsetView.Hex;
                        break;

                    case 'd':
                    case 'D':
                        MainApp.OffsetView = OffsetView.Dec;
                        break;

                    case 'o':
                    case 'O':
                        MainApp.OffsetView = OffsetView.Oct;
                        break;

                    default:
                        Console.WriteLine(
                            ErrorCode.CLI_InvalidOffsetView
                            .GetMessage(args[i + 1])
                            );
#if DEBUG
                        Console.ReadLine();
#endif
                        return(ErrorCode.CLI_InvalidOffsetView.ToInt());
                    }
                    break;

                case "-w":
                case "/w":
                {
                    int b = MainApp.BytesPerRow;
                    if (char.ToLower(args[i + 1][0]) != 'a')         // Automatic, in case to overwrite settings
                    {
                        MainApp.BytesPerRow = 0;
                    }
                    else if (!int.TryParse(args[i + 1], out b))
                    {
                        Console.WriteLine(
                            ErrorCode.CLI_InvalidWidth
                            .GetMessage(args[i + 1])
                            );
#if DEBUG
                        Console.ReadLine();
#endif
                        return(ErrorCode.CLI_InvalidWidth.ToInt());
                    }
                    MainApp.BytesPerRow = b;
                }
                break;

                case "-dump":
                case "/dump":
                    dump = true;
                    break;

                case "/?":
                case "-h":
                case "-help":
                case "--help":
                    ShowHelp();
                    return(0);

                case "-v":
                case "/ver":
                case "--version":
                    ShowVersion();
                    return(0);
                }
            }

            if (dump)
            {
                Console.Write("Dumping file... ");
                ErrorCode err = Dumper.Dump(entry, MainApp.BytesPerRow, MainApp.OffsetView);

                Console.WriteLine(err.GetMessage());

                return(err.ToInt());
            }
            else
            {
#if DEBUG
                // I want Visual Studio to catch the exceptions!
                MainApp.Open(entry);

                ErrorCode e = MainApp.LastError;

                Console.Clear();
                Console.WriteLine(
                    $"ERROR: {e} - {e.GetMessage()} (0x{e.ToInt():X8})"
                    );
                Console.ReadKey();
                return(e.ToInt());
#else
                try
                {
                    MainApp.Open(entry);

                    if (MainApp.LastError != ErrorCode.Success)
                    {
                        Console.WriteLine(MainApp.LastError.GetMessage());
                    }

                    return(MainApp.LastError.ToInt());
                }
                catch (Exception e)
                {
                    Abort(e);
                }

                return(0);
#endif
            }
        }
コード例 #21
0
 private void ChangeServerRequest()
 {
     cmd.Action = WerewolfCommand.CommandEnum.ChangeServer;
     MainApp.Notify(cmd, this, playerServer);
     ShowServer.text = string.Format("Current Server: {0} Player", playerServer);
 }
コード例 #22
0
 private void Awake()
 {
     Instance = this;
 }
コード例 #23
0
    public static int Main() {
        MainApp a = new MainApp();

        // simple delegate roundtrip
        {
            int x = CallSimpleDelegate(a.CreateSimpleCallback(false), 1);
            if (x != 2) {
                Console.WriteLine("Unexpected value: " + x.ToString());
                return 1;
            }
        }
        Console.WriteLine("Simple delegate roundtrip passed");

        // delegate roundtrip
        {
            double x = CallDelegate(a.CreateCallback(false), new MyValue(1));
            if (x != 2) {
                Console.WriteLine("Unexpected value: " + x.ToString());
                return 1;
            }
        }
        Console.WriteLine("Delegate roundtrip passed");

        // simple delegate roundtrip - crossdomain
        {
            AppDomain app = AppDomain.CreateDomain("MyDomain");
            MainApp remoteapp = (MainApp)app.CreateInstanceAndUnwrap ("interoptest1", "MainApp");
            MySimpleDelegate callback = remoteapp.CreateSimpleCallback(true);

            int x = CallSimpleDelegate(callback, 1);
            if (x != 2) {
                Console.WriteLine("Unexpected value: " + x.ToString());
                return 1;
            }
        }
        Console.WriteLine("Simple delegate roundtrip crossdomain passed");

        // delegate roundtrip - crossdomain
        {
            AppDomain app = AppDomain.CreateDomain("MyDomain");
            MainApp remoteapp = (MainApp)app.CreateInstanceAndUnwrap ("interoptest1", "MainApp");
            MyDelegate callback = remoteapp.CreateCallback(true);

            double x = CallDelegate(callback, new MyValue(1));
            if (x != 2) {
                Console.WriteLine("Unexpected value: " + x.ToString());
                return 1;
            }
        }
        Console.WriteLine("Delegate roundtrip crossdomain passed");

        // ffi roundtrip
        {
            double d = CallFFI(a, new MyValue(1));
            if (d != 2) {
                Console.WriteLine("Unexpected value: " + d.ToString());
                return 2;
            }
        }
        Console.WriteLine("FFI roundtrip passed");

        // array marshaling
        {
            int[] rg = new int[4];
            rg[0] = 12;
            rg[1] = 33;
            rg[2] = -21;
            rg[3] = 18;
            int sum = Sum(rg.Length, rg);
            if (sum != 42) {
                Console.WriteLine("Unexpected value: " + sum.ToString());
                return 3;
            }                           
        }
        Console.WriteLine("Array marshalling passed");

        // array marshaling ex
        {
            MyStruct[] rg = new MyStruct[7];
            rg[0].value = new MyValue(2314);
            rg[1].value = new MyValue(3452);
            rg[2].value = new MyValue(3235);
            rg[3].value = new MyValue(3452);
            rg[4].value = new MyValue(6980);
            rg[5].value = new MyValue(3133);
            rg[6].value = new MyValue(3426);
            int sum = ObjectSum(rg.Length, rg);
            if (sum != 25992) {
                Console.WriteLine("Unexpected value: " + sum.ToString());
                return 4;
            }                           
        }
        Console.WriteLine("Array marshalling ex passed");

        // errorinfo roundtrip
        {
            bool thrown = false;
          
            try {
                ReallyBadError(new MyValue(0));
            }
            catch (Exception e)
            {
                string s = e.ToString();
                if (s.IndexOf("qwerty") == -1) {
                    Console.WriteLine("Unexpected value: " + s);
                    return 5;
                }                           
                thrown = true;
            }

            if (!thrown) {
                Console.WriteLine("Exception wasn't thrown");
                return 5;
            }                            
        }
        Console.WriteLine("IErrorInfo roundtrip passed");

        // delegate roundtrip
        {
            MySimpleDelegate d1 = a.CreateSimpleCallback(false);            
            MySimpleDelegate d2 = DelegateMarshal(d1);
            if (d1 != d2) {
                Console.WriteLine("Delegate marshal failed");
                return 8;
            }
        }
        Console.WriteLine("Delegate marshal passed");

        Console.WriteLine("All test passed");
        return 0;
    }
コード例 #24
0
        private void addKrigingLayerButton_Click(object sender, EventArgs e, MainApp.Forms.KrigingLayerSelectionFrom fm)
        {
            foreach (var item in fm.LayersItem)
            {
                if (item.isSelected)
                {

                    KrigingField = new InterpolatedFields();
                    KrigingField.ZData = item.getZData();
                    KrigingField.Field = !string.IsNullOrEmpty(item.Layer.LegendText) ? item.Layer.LegendText : item.Layer.DataSet.Name;
                    KrigingField.Image = item.ImagePath;
                    KrigingField.PieChartData = item.PieChartData;

                    ColorsList = item.ColorsList;

                    fm.Close();

                    pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                    pictureBox1.Image = Image.FromFile(KrigingField.Image);

                    break;
                }
            }

        }
コード例 #25
0
	public MyGUI(MainApp ma):this(ma, 100, 200, 400, 200){ }
コード例 #26
0
 public void Randomize()
 {
     a += (int)MainApp.Randomizer();
 }
コード例 #27
0
	public MenuGUI(MainApp ma):this(ma, 125, 125, 300, 300){ }
コード例 #28
0
    static public void RunTests(MainApp This)
    {
        String values;

        Struct1  s1 = new Struct1();
        Struct2  s2 = new Struct2();
        Struct3  s3 = new Struct3();
        Struct4  s4 = new Struct4();
        Struct5  s5 = new Struct5();
        Struct6  s6 = new Struct6();
        Struct8  s8 = new Struct8();
        Valuesa  v  = new Valuesa();
        float    f;
        double   d;
        Object   o;
        String   s;
        Enumacek e;

        sbyte  p1;
        byte   p2;
        short  p3;
        ushort p4;
        int    p5;
        uint   p6;
        long   p7;
        ulong  p8;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s6.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = This;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        p1 = (sbyte)Randomizer();
        p2 = (byte)Randomizer();
        p3 = (short)Randomizer();
        p4 = (ushort)Randomizer();
        p5 = (int)Randomizer();
        p6 = (uint)Randomizer();
        p7 = (long)Randomizer();
        p8 = (ulong)Randomizer();

        // set all fields
        This._s1 = s1;
        This._s2 = s2;
        This._s3 = s3;
        This._s4 = s4;
        This._s5 = s5;
        This._s6 = s6;
        This._s8 = s8;
        This._v  = v;
        This._f  = f;
        This._d  = d;
        This._o  = o;
        This._s  = s;
        This._e  = e;
        This._p1 = p1;
        This._p2 = p2;
        This._p3 = p3;
        This._p4 = p4;
        This._p5 = p5;
        This._p6 = p6;
        This._p7 = p7;
        This._p8 = p8;

        values = This.ToString();

        if (values !=
            "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 931407168" +
            " 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159779942285264" +
            " -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18" +
            " MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481" +
            " 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1 = This.Foo(p1);
        p2 = This.Foo(p2);
        p3 = This.Foo(p3);
        p4 = This.Foo(p4);
        p5 = This.Foo(p5);
        p6 = This.Foo(p6);
        p7 = This.Foo(p7);
        p8 = This.Foo(p8);

        // verify the values of all fields
        values =
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "-96 114 -32144 34594 -19884190" +
            "08 4093738962 3406623781630010640 2826742804614237570 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        s1 = This.Foo(s2, ref s3, p1, ref p1);
        s2 = This.Foo(ref s4, s3, p3, ref p3);
        s3 = This.Foo(s4, ref s5, p5, ref p5);
        s4 = This.Foo(ref s8, s5, p7, ref p7);
        s5 = This.Foo(s8, ref v, p2, ref p2);
        s6 = This.Foo(s5, ref v, p2, ref p2);
        s8 = This.Foo(ref f, v, p4, ref p4);
        v  = This.Foo(f, ref d, p6, ref p6);
        f  = This.Foo(ref s1, d, p8, ref p8);
        d  = This.Foo(ref s2, s1, s, ref s);

        // verify the values of all fields
        values =
            This.ToString();

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159" +
            "779942285264 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.2129737216" +
            "4627E+18 MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 20468" +
            "69481 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "170 233 145 161 144 249 49 128 137 232 1" +
            "12 25 216 241 192 263746504 217 24 177 0 9 104 225 80 17 7072 -1278944919 567925" +
            "9233286952200 964207834727950401 -272742416 14745 88 -7.848656E+18 3.16790391993" +
            "929E+18 MainApp -5893266573950244255 Hali -16 220 21112 49618 -153164056 1655108" +
            "490 -374121548284004952 17419808404417595330 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1 = This._s1;
        s2 = This._s2;
        s3 = This._s3;
        s4 = This._s4;
        s5 = This._s5;
        s6 = This._s6;
        s8 = This._s8;
        v  = This._v;
        f  = This._f;
        d  = This._d;
        o  = This._o;
        s  = This._s;
        e  = This._e;
        p1 = This._p1;
        p2 = This._p2;
        p3 = This._p3;
        p4 = This._p4;
        p5 = This._p5;
        p6 = This._p6;
        p7 = This._p7;
        p8 = This._p8;

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -90161597799422852" +
            "64 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18 M" +
            "ainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481 1703" +
            "311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        This.Foo(This, "O", "S",
                 (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(),
                 (long)Randomizer(), (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
                 (long)Randomizer(), (long)Randomizer(),
                 (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(), (ushort)Randomizer(),
                 (int)Randomizer(), (uint)Randomizer(), (long)Randomizer(), (ulong)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(), (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer());
    }
コード例 #29
0
ファイル: MenuBarPanel.cs プロジェクト: dd86k/0xdd
        public static void Initialize()
        {
            MenuItem[] mainItems =
            {
                new MenuItem("File",
                             new MenuItem("Dump",                                            () =>          {
                    Exit();
                    InfoPanel.Message("Dumping...");
                    Dumper.Dump(FilePanel.File.FullName,                                     MainApp.BytesPerRow, MainApp.OffsetView);
                    InfoPanel.Message("Done");
                }),
                             new MenuItem(),
                             new MenuItem("Exit",                                            () =>          {
                    inMenu = false; MainApp.Exit();
                })
                             ),                                                              /*
                                                                                              * new MenuItem("Edit", null,
                                                                                              * new MenuItem("Test")
                                                                                              * ),*/
                new MenuItem("Search",
                             new MenuItem("Find byte...",                                    () =>          {
                    Exit();
                    Dialog.PromptFindByte();
                }),
                             new MenuItem("Find ASCII string...",                            () =>          {
                    Exit();
                    Dialog.PromptSearchString();
                }),
                             new MenuItem(),
                             new MenuItem("Goto...",                                         () =>          {
                    Exit();
                    Dialog.PromptGoto();
                })
                             ),
                new MenuItem("View",
                             new MenuItem("Offset view...",                                  () =>          {
                    Exit();
                    Dialog.PromptOffset();
                }),
                             new MenuItem(),
                             new MenuItem("File info",                                       () =>          {
                    Exit();
                    InfoPanel.DisplayFileInfo();
                }),
                             new MenuItem(),
                             new MenuItem("Refresh",                                         () =>          {
                    Exit();
                    FilePanel.Refresh();
                })
                             ),                                                              /*
                                                                                              * new MenuItem("Tools", null,
                                                                                              * new MenuItem("Test")
                                                                                              * ),*/
#if DEBUG
                new MenuItem("Debug",
                             new MenuItem("Show Test Window",                                () =>          {
                    Exit();
                    new Window("Test",                                                       new Control[]  {
                        new Label("Hello World!")
                    }).Show();
                }),
                             new MenuItem("Goto",                                            () =>          {
                    Exit();
                    new Window("Goto",                                                       new Control[]  {
                        new Label("Hello World!",                                                      1, 1),
                        new Button("OK",                                               12, 3, action: () => { MainApp.Goto(0xdd);})
                    }).Show();
                }),
                             new MenuItem("Preferences...",                                  () =>          {
                    Exit();
                    new Window("Test",                                                 50, 6, new Control[] {
                        new Label("Setting 1:",                                                      1, 1),
                        new Button("OK",                                                               12, 3)
                    }).Show();
                })
                             ),
#endif
                new MenuItem("?",
                             new MenuItem("About",                                           () =>          {
                    Exit();
                    Dialog.GenerateWindow(
                        title: "About",
                        text:
                        $"{Program.Name} v{Program.Version}\nCopyright (c)  2015-2017 dd86k",
                        width: 36,
                        height: 5
                        );
                })
                             )
            };

            // Make an array for each, remember that arrays are REFERENCED.
            _pos = new int[mainItems.Length];
            _miw = new int[mainItems.Length];

            MenuItems = new List <MenuItem>(mainItems.Length);
            MenuItems.AddRange(mainItems);

            _barlength = 0;
            // Get menubar's length with items
            for (int i = 0; i < MenuItems.Count; ++i)
            {
                MenuItem item = MenuItems[i];

                _pos[i] = _barlength;

                _barlength += item.Text.Length + 2;

                int max = 0; // Get longuest string in each submenus
                for (int si = 0; si < item.Items.Count; si++)
                {
                    MenuItem subitem = MenuItems[i].Items[si];

                    if (!subitem.IsSeparator)
                    {
                        int len = subitem.Text.Length;

                        if (len > max)
                        {
                            max = len;
                        }
                    }
                }
                _miw[i] = max;
            }

            Draw();
        }
コード例 #30
0
 public void Randomize()
 {
     a += (byte)MainApp.Randomizer();
     b += (byte)MainApp.Randomizer();
     c += (byte)MainApp.Randomizer();
 }
コード例 #31
0
 private void RequestUpdateMainGame()
 {
     cmd.Action = WerewolfCommand.CommandEnum.RequestUpdate;
     MainApp.Notify(cmd, this);
 }
コード例 #32
0
	public static void Main(){
		MainApp ma = new MainApp();
		Application.Run(ma._gui);
	} // end Main()
コード例 #33
0
    public static void Main()
    {
        // Test AddFirst() method
        MainApp.list.AddFirst(3);
        MainApp.list.AddFirst(2);
        MainApp.list.AddFirst(1);
        MainApp.PrintListValues();

        // Test Remove() method
        MainApp.list.Remove(current_node.Previous);
        MainApp.PrintListValues();

        // Test AddBefore() method
        MainApp.list.AddBefore(current_node.Previous, 4);
        MainApp.PrintListValues();

        // Test AddAfter() method
        MainApp.list.AddAfter(MainApp.list.Find(4), 5);
        MainApp.PrintListValues();

        // Remove last element
        MainApp.list.Remove(MainApp.list.Last);
        MainApp.PrintListValues();

        // Remove first element
        MainApp.list.Remove(MainApp.list.First);
        MainApp.PrintListValues();

        // Test AddLast() method
        MainApp.list.AddLast(6);
        MainApp.PrintListValues();
        Console.WriteLine("List has " + MainApp.list.Count + " items");

        // Test AddAfter() method again
        MainApp.list.AddAfter(MainApp.list.Find(6), 7);
        MainApp.PrintListValues();

        // Test AddBefore method again
        MainApp.list.AddBefore(MainApp.list.Find(4), 3);
        MainApp.PrintListValues();

        // Let's step forward through the list
        Console.Write("First element = " + MainApp.list.First.Value + " ");
        Console.Write("Second element = " + MainApp.list.First.Next.Value + " ");
        Console.Write("Third element = " + MainApp.list.First.Next.Next.Value + " ");
        Console.Write("Forth element = " + MainApp.list.First.Next.Next.Next.Value + " ");
        Console.Write("Fifth element = " + MainApp.list.First.Next.Next.Next.Next.Value + " ");
        Console.Write("Next element = " + MainApp.list.First.Next.Next.Next.Next.Next.Value + " ");
        Console.WriteLine();

        // Now backwards
        Console.Write("Last element = " + MainApp.list.Last.Value + " ");
        Console.Write("Next element = " + MainApp.list.Last.Previous.Value + " ");
        Console.Write("Next element = " + MainApp.list.Last.Previous.Previous.Value + " ");
        Console.Write("Next element = " + MainApp.list.Last.Previous.Previous.Previous.Value + " ");
        Console.Write("Next element = " + MainApp.list.Last.Previous.Previous.Previous.Previous.Value + " ");

        Console.WriteLine("\n----------------------------------------------");
        Console.WriteLine("Number of elements in the list: " + MainApp.list.Count);
        while (MainApp.list.Count > 0)
        {
            MainApp.list.Remove(MainApp.list.Last);
        }
        Console.WriteLine("Number of elements in the list: " + MainApp.list.Count);
    }
コード例 #34
0
        public Department GetDepartmentInfo(Options opt, MainApp ep)
        {
            var others = ep.GetDepartments(opt);

            return(others[0]);
        }
コード例 #35
0
 public void BackBtnPressed()
 {
     cmd.Action = WerewolfCommand.CommandEnum.SignOut;
     MainApp.Notify(cmd, this);
 }
コード例 #36
0
	public static void Main(){
		MainApp ma = new MainApp();
		ma.CreateEmployees();
		ma._employeeList.Sort();
		ma.ListEmployees();
	} // end Main()
コード例 #37
0
        /// //////////////////////////////////////////////////////
        /// ////////////////////////// HELPERS  /// //////////////////////////
        /// //////////////////////////////////////////////////////

        private void searchCustomerText()
        {
            this.Visible = false;
            MainApp.GetDBConnection().searchCustomer(mainForm.GetDataGridView(), textBoxSearchString.Text);
            mainForm.GetDataGridView().Columns["TS"].Visible = false;
        }
コード例 #38
0
    public void Foo(MainApp a, Object o, String s,
        float f1, double d1, float f2, double d2, float f3, double d3,
        long x1, long x2, long x3, long x4, long x5, long x6,
        sbyte y1, byte y2, short y3, ushort y4, int y5, uint y6, long y7, ulong y8,
        float f4, double d4, float f5, double d5, float f6, double d6) {

        String values =
            a.GetType().ToString() + " " +
            o.ToString() + " " +
            s.ToString() + " " +
            f1.ToString() + " " +
            d1.ToString() + " " +
            f2.ToString() + " " +
            d2.ToString() + " " +
            f3.ToString() + " " +
            d3.ToString() + " " +
            x1.ToString() + " " +
            x2.ToString() + " " +
            x3.ToString() + " " +
            x4.ToString() + " " +
            x5.ToString() + " " +
            x6.ToString() + " " +
            y1.ToString() + " " +
            y2.ToString() + " " +
            y3.ToString() + " " +
            y4.ToString() + " " +
            y5.ToString() + " " +
            y6.ToString() + " " +
            y7.ToString() + " " +
            y8.ToString() + " " +
            f4.ToString() + " " +
            d4.ToString() + " " +
            f5.ToString() + " " +
            d5.ToString() + " " +
            f6.ToString() + " " +
            d6.ToString() + " " +
            ".";

        if (values != "MainApp O S -9.327176E+17 -3.96300887748629E+1" +
            "8 -5.186961E+18 -1.49305767435013E+18 -5.895485E+18 6.9729019923856E+17 90407457" +
            "83328474920 3866776359567051553 6713255483212945424 1426425148927471225 -7819770" +
            "850983417224 -1407218523638657967 96 169 29640 38785 -1985398096 502707417 -7211" +
            "241837460167912 17618812656075189425 8.68788E+16 -5.610971897227E+18 5.33869E+18" +
            " 4.23216032051367E+17 1.208359E+18 -4.17734217115817E+18 .")
        {
            Console.WriteLine("void Foo(...): unexpected values: " + values);
            Fail(20);
        }
    }
コード例 #39
0
ファイル: MessagesView.cs プロジェクト: battyone/ChillSched
        private void ClearMessageDisplay()
        {
            MainApp form = (_controls.Get(_parentId, _parentId) as FormController).GetControl() as MainApp;

            form.TriggerDelayedRefresh();
        }
コード例 #40
0
 private void searchCustomerNumber()
 {
     this.Visible = false;
     MainApp.GetDBConnection().searchCustomerCN(mainForm.GetDataGridView(), textBoxInputCN.Text);
 }