Пример #1
0
 internal void ResetFloatMode()
 {
     if (floatingWindow != null)
     {
         floatingWindow.Remove(Widget);
         floatingWindow.Destroy();
         floatingWindow = null;
         widget.UpdateBehavior();
     }
 }
Пример #2
0
 protected void OnButtonMapInWindowClicked(object sender, EventArgs e)
 {
     if (mapWindow == null)
     {
         toggleButtonHideAddresses.Sensitive = false;
         toggleButtonHideAddresses.Active    = false;
         mapWindow = new Gtk.Window("Карта мониторинга автомобилей на маршруте");
         mapWindow.SetDefaultSize(700, 600);
         mapWindow.DeleteEvent += MapWindow_DeleteEvent;
         vboxRight.Remove(gmapWidget);
         mapWindow.Add(gmapWidget);
         mapWindow.Show();
     }
     else
     {
         toggleButtonHideAddresses.Sensitive = true;
         mapWindow.Remove(gmapWidget);
         vboxRight.PackEnd(gmapWidget, true, true, 1);
         gmapWidget.Show();
         mapWindow.Destroy();
         mapWindow = null;
     }
 }
Пример #3
0
        public static void Main()
        {
            Application.Init();
            var window = new Window("Sharp Test");

            window.Resize(600, 400);
            //window.SetIconFromFile("/home/hubert/SharpTest/SharpTest/images/icon.png");
            window.DeleteEvent += Window_Delete;
            //File choosing components
            var labelOsName = new Label("OS Version: " + OsVersion);

            var labelPyhtonVer = new Label("Python ver: " + PythonVer);

            var labelChoose = new Label("Choose python file.");

            var labelFileStatus = new Label {
                Markup = "<span color=\"red\">Wrong file.</span>"
            };

            var fileButton = new FileChooserButton("Choose file", FileChooserAction.Open);

            var scanButton = new Button("Scan file");

            scanButton.SetSizeRequest(100, 50);

            var boxStart = new VBox();

            boxStart.PackStart(labelOsName, false, false, 5);
            boxStart.PackStart(labelPyhtonVer, false, false, 5);
            boxStart.PackStart(labelChoose, false, false, 5);
            boxStart.PackStart(fileButton, false, false, 5);
            boxStart.PackStart(labelFileStatus, false, false, 5);
            boxStart.PackStart(scanButton, false, false, 100);

            //Scaning window components
            var labelTest = new Label("Error while scanning file");

            labelTest.SetPadding(5, 5);

            var scrolledWin = new ScrolledWindow();

            scrolledWin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            scrolledWin.Add(labelTest);

            var boxScan = new VBox();

            boxScan.PackStart(scrolledWin, true, true, 5);


            scanButton.Clicked += (sender, args) => {
                var result = ScanFile(fileButton.Filename);
                if (result == null)
                {
                    labelFileStatus.Show();
                }
                else
                {
                    labelFileStatus.Hide();
                    var structure = "";
                    var classes   = new List <string>(result.Keys);
                    //Add classes
                    foreach (var _class in classes)
                    {
                        structure += "Class: " + _class + "\n";
                        foreach (var method in result[_class])
                        {
                            //Add method name
                            structure += "|__ Method: " + method["name"] + "\n";
                            //Add params
                            var parameters = "";
                            int i          = 0;
                            foreach (var param in (IEnumerable)method["param"])
                            {
                                if (i > 0)
                                {
                                    parameters += ",";
                                }
                                parameters += " " + param;
                                i++;
                            }
                            structure += "|____ Params: " + parameters + "\n";
                            //Add return
                            structure += "|____ Return: " + method["return"] + "\n";
                        }

                        structure += "\n";
                    }

                    labelTest.Text = structure;
                    window.Remove(boxStart);
                    window.Add(boxScan);
                    window.ShowAll();
                }
            };

            window.Add(boxStart);
            window.ShowAll();
            //Hide some widgets

            labelFileStatus.Hide();
            Application.Run();
        }