Example #1
0
        void ShowEditPage()
        {
            // Set the initial text
            textView.Buffer.Text = text;

            // Hide all the widgets on the view page
            textLabel.Hide();
            deleteButton.Hide();
            editButton.Hide();

            // Show all the widgets on the edit page
            textView.Show();
            cancelButton.Show();
            saveButton.Show();

            // TODO: Grab the keyboard focus so the cursor is in the textView.
//			Gtk.Widget aParent = this.Parent;
//			while (aParent != null) {
//				// Get our parent Gtk.Window
//				if (aParent is Gtk.Dialog) {
//					(aParent as Gtk.Dialog).Focus = textView;
//					break;
//				}
//
//				aParent = aParent.Parent;
//			}

            // Switch to the Edit Page
            Page = editPageId;
        }
Example #2
0
        void on_button_reportes_clicked(object sender, EventArgs args)
        {
            Glade.XML gxml = new Glade.XML(null, "caja.glade", "rango_de_fecha", null);
            gxml.Autoconnect(this);
            rango_de_fecha.Show();

            checkbutton_impr_todo_proce.Label   = "Imprime TODO";
            entry_referencia_inicial.IsEditable = false;
            entry_referencia_inicial.Text       = DateTime.Now.ToString("dd-MM-yyyy");
            entry_dia1.KeyPressEvent           += onKeyPressEvent;
            entry_mes1.KeyPressEvent           += onKeyPressEvent;
            entry_ano1.KeyPressEvent           += onKeyPressEvent;
            entry_dia2.KeyPressEvent           += onKeyPressEvent;
            entry_mes2.KeyPressEvent           += onKeyPressEvent;
            entry_ano2.KeyPressEvent           += onKeyPressEvent;
            entry_dia1.Text       = DateTime.Now.ToString("dd");
            entry_mes1.Text       = DateTime.Now.ToString("MM");
            entry_ano1.Text       = DateTime.Now.ToString("yyyy");
            entry_dia2.Text       = DateTime.Now.ToString("dd");
            entry_mes2.Text       = DateTime.Now.ToString("MM");
            entry_ano2.Text       = DateTime.Now.ToString("yyyy");
            button_salir.Clicked += new EventHandler(on_cierraventanas_clicked);
            button_imprime_rangofecha.Clicked += new EventHandler(imprime_reporte_vision);
            label_orden.Hide();
            label_nom_cliente.Hide();
            label142.Hide();
            radiobutton_cliente.Hide();
            radiobutton_fecha.Hide();
            checkbutton_todos_los_clientes.Hide();
            entry_referencia_inicial.Hide();
            entry_cliente.Hide();
            button_busca_cliente.Hide();
        }
Example #3
0
    public ConfirmWindow(string text1, string link, string question)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "confirm_window.glade", "confirm_window", null);
        gladeXML.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(confirm_window);

        label1.Text      = text1;
        label1.UseMarkup = true;

        if (link != "")
        {
            label_link.Text      = link;
            label_link.UseMarkup = true;
        }
        else
        {
            label_link.Hide();
        }

        if (question != "")
        {
            label_question.Text      = question;
            label_question.UseMarkup = true;
        }
        else
        {
            label_question.Hide();
        }
    }
        void Install(Gtk.Alignment commandBox, Button installButton, Update update)
        {
            if (update.InstallAction == null)
            {
                DesktopService.ShowUrl(update.Url);
                return;
            }

            installButton.Hide();

            if (installing)
            {
                Gtk.Label lab = new Gtk.Label(GettextCatalog.GetString("Waiting"));
                commandBox.Child.Destroy();
                commandBox.Add(lab);
                lab.Show();
                installQueue.Enqueue(delegate {
                    lab.Hide();
                    RunInstall(commandBox, update);
                });
                return;
            }

            RunInstall(commandBox, update);
        }
Example #5
0
        public lista_ordenes_compra()
        {
            Glade.XML gxml = new Glade.XML(null, "almacen_costos_compras.glade", "envio_almacenes", null);
            gxml.Autoconnect(this);

            connectionString = conexion_a_DB._url_servidor + conexion_a_DB._port_DB + conexion_a_DB._usuario_DB + conexion_a_DB._passwrd_user_DB;
            nombrebd         = conexion_a_DB._nombrebd;

            envio_almacenes.Title = "LISTA ORDENES DE COMPRA";
            entry_dia_inicio.Text = DateTime.Now.ToString("dd");
            entry_mes_inicio.Text = DateTime.Now.ToString("MM");
            entry_ano_inicio.Text = DateTime.Now.ToString("yyyy");

            entry_dia_termino.Text = DateTime.Now.ToString("dd");
            entry_mes_termino.Text = DateTime.Now.ToString("MM");
            entry_ano_termino.Text = DateTime.Now.ToString("yyyy");

            //hbox1.Hide();
            label3.Hide();
            checkbutton2.Hide();
            label1.Text = "Proveedor ";
            entry_codigo_producto.Hide();
            entry_desc_producto.Hide();
            button_buscar_prodreq.Hide();

            checkbutton_seleccion_presupuestos.Hide();

            button_salir.Clicked             += new EventHandler(on_cierraventanas_clicked);
            button_buscar.Clicked            += new EventHandler(on_buscar_ordencompra_clicked);
            button_rep.Clicked               += new EventHandler(on_button_rep_clicked);
            checkbutton_todos_envios.Clicked += new EventHandler(on_checkbutton_todos_envios);
            button_buscar1.Clicked           += new EventHandler(on_button_buscar_proveedor_clicked);

            crea_treeview_ordendecompra();
        }
Example #6
0
        internal bool Refresh()
        {
            DaemonInformationRequest  request = new DaemonInformationRequest(false, false, true, true);
            DaemonInformationResponse response;

            try {
                response = (DaemonInformationResponse)request.Send();
            } catch (Beagle.ResponseMessageException) {
                Console.WriteLine("Could not connect to the daemon.");
                return(false);
            }

            if (response.IsIndexing)
            {
                note.Show();
            }
            else
            {
                note.Hide();
            }

            int           i  = 0;
            StringBuilder sb = new StringBuilder();

            foreach (QueryableStatus status in response.IndexStatus)
            {
                if (i++ > 20)
                {
                    break;
                }

                // Skip all those metadata and networking services backends
                if (status.ItemCount < 0)
                {
                    continue;
                }

                sb.AppendFormat("<b>{0}</b>: {1}", status.Name, status.ItemCount);

                if (status.ProgressPercent > 0)
                {
                    sb.AppendFormat(" ({0})", status.ProgressPercent);
                }

                sb.Append("\n");
            }

            label.Markup = sb.ToString();

            label.Show();

            return(true);
        }
        public VersionInformationDialog() : base()
        {
            AccelGroup accel_group = new AccelGroup();
            AddAccelGroup(accel_group);
            Modal = true;

            Button button = new Button("gtk-close");
            button.CanDefault = true;
            button.UseStock = true;
            button.Show();
            DefaultResponse = ResponseType.Close;
            button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            AddActionWidget(button, ResponseType.Close);

            Title = Catalog.GetString("Assembly Version Information");
            BorderWidth = 10;

            version_tree = new TreeView();

            version_tree.RulesHint = true;
            version_tree.AppendColumn(Catalog.GetString("Assembly Name"),
                new CellRendererText(), "text", 0);
            version_tree.AppendColumn(Catalog.GetString("Version"),
                new CellRendererText(), "text", 1);

            version_tree.Model = FillStore();
            version_tree.CursorChanged += OnCursorChanged;

            ScrolledWindow scroll = new ScrolledWindow();
            scroll.Add(version_tree);
            scroll.ShadowType = ShadowType.In;
            scroll.SetSizeRequest(420, 200);

            VBox.PackStart(scroll, true, true, 0);
            VBox.Spacing = 5;

            path_label = new Label();
            path_label.Ellipsize = Pango.EllipsizeMode.End;
            path_label.Hide();
            path_label.Xalign = 0.0f;
            path_label.Yalign = 1.0f;
            VBox.PackStart(path_label, false, true, 0);

            scroll.ShowAll();
        }
 void LoadData()
 {
     if (!string.IsNullOrEmpty(exception.Message))
     {
         messageLabel.Show();
         messageLabel.Text = exception.Message;
         if (messageLabel.SizeRequest().Width > 400)
         {
             messageLabel.WidthRequest = 400;
             messageLabel.Wrap         = true;
         }
     }
     else
     {
         messageLabel.Hide();
     }
 }
Example #9
0
    protected virtual void initializeValues()
    {
        typeOfTest           = Constants.TestTypes.JUMP;
        showType             = true;
        showRunStart         = false;
        showTv               = true;
        showTc               = true;
        showFall             = true;
        showDistance         = true;
        distanceCanBeDecimal = true;
        showTime             = true;
        showSpeed            = true;
        showWeight           = true;
        showLimited          = true;
        showAngle            = true;
        showMistakes         = false;

        label_simulated.Hide();
    }
Example #10
0
    SessionUploadWindow(Gtk.Window parent)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "session_upload.glade", "session_upload", "chronojump");
        gladeXML.Autoconnect(this);
        session_upload.Parent = parent;

        //put an icon to window
        UtilGtk.IconWindow(session_upload);

        createTreeViews(
            treeview_persons,
            treeview_jumps,
            treeview_jumps_rj,
            treeview_runs,
            treeview_runs_i,
            treeview_rts,
            treeview_pulses,
            treeview_mcs
            );

        store_persons = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
        store_j       = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_jr      = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_r       = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_ri      = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_rts     = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_pulses  = new TreeStore(typeof(string), typeof(string), typeof(string));
        store_mcs     = new TreeStore(typeof(string), typeof(string), typeof(string));

        treeview_persons.Model  = store_persons;
        treeview_jumps.Model    = store_j;
        treeview_jumps_rj.Model = store_jr;
        treeview_runs.Model     = store_r;
        treeview_runs_i.Model   = store_ri;
        treeview_rts.Model      = store_rts;
        treeview_pulses.Model   = store_pulses;
        treeview_mcs.Model      = store_mcs;

        label_thanks.Hide();
        button_close.Sensitive = false;
    }
Example #11
0
    public ConfirmWindowJumpRun(string text1, string question)
    {
        //Setup (text, table, uniqueID);
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "confirm_window.glade", "confirm_window", "chronojump");
        gladeXML.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(confirm_window);

        label1.Text = text1;
        if (question == "")
        {
            label_question.Hide();
        }
        else
        {
            label_question.Text = question;
        }
    }
        public Gtk.Requisition ShowParameterInfo(IParameterDataProvider provider, int overload, int currentParam)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            int numParams = System.Math.Max(0, provider.GetParameterCount(overload));

            string[] paramText = new string[numParams];
            for (int i = 0; i < numParams; i++)
            {
                string txt = provider.GetParameterMarkup(overload, i);
                if (i == currentParam)
                {
                    txt = "<u><span foreground='darkblue'>" + txt + "</span></u>";
                }
                paramText [i] = txt;
            }
            string text = provider.GetMethodMarkup(overload, paramText, currentParam);

            desc.Markup = text;

            if (provider.OverloadCount > 1)
            {
                count.Show();
                goPrev.Show();
                goNext.Show();
                count.Text = GettextCatalog.GetString("{0} of {1}", overload + 1, provider.OverloadCount);
            }
            else
            {
                count.Hide();
                goPrev.Hide();
                goNext.Hide();
            }
            Gtk.Requisition req = mainBox.SizeRequest();
            Resize(req.Width, req.Height);
            return(req);
        }
Example #13
0
        public reporte_de_abonos(string _nombrebd_, string tiporpt_, string LoginEmpleado_)
        {
            connectionString        = conexion_a_DB._url_servidor + conexion_a_DB._port_DB + conexion_a_DB._usuario_DB + conexion_a_DB._passwrd_user_DB;
            nombrebd                = conexion_a_DB._nombrebd;
            escala_en_linux_windows = classpublic.escala_linux_windows;
            tiporpt       = tiporpt_;
            LoginEmpleado = LoginEmpleado_;
            Glade.XML gxml = new Glade.XML(null, "caja.glade", "rango_de_fecha", null);
            gxml.Autoconnect(this);
            rango_de_fecha.Show();

            checkbutton_impr_todo_proce.Label   = "Imprime TODO";
            entry_referencia_inicial.IsEditable = false;
            entry_referencia_inicial.Text       = DateTime.Now.ToString("dd-MM-yyyy");
            entry_dia1.KeyPressEvent           += onKeyPressEvent;
            entry_mes1.KeyPressEvent           += onKeyPressEvent;
            entry_ano1.KeyPressEvent           += onKeyPressEvent;
            entry_dia2.KeyPressEvent           += onKeyPressEvent;
            entry_mes2.KeyPressEvent           += onKeyPressEvent;
            entry_ano2.KeyPressEvent           += onKeyPressEvent;
            entry_dia1.Text       = DateTime.Now.ToString("dd");
            entry_mes1.Text       = DateTime.Now.ToString("MM");
            entry_ano1.Text       = DateTime.Now.ToString("yyyy");
            entry_dia2.Text       = DateTime.Now.ToString("dd");
            entry_mes2.Text       = DateTime.Now.ToString("MM");
            entry_ano2.Text       = DateTime.Now.ToString("yyyy");
            button_salir.Clicked += new EventHandler(on_cierraventanas_clicked);
            button_imprime_rangofecha.Clicked += new EventHandler(imprime_reporte_abonos);
            label_orden.Hide();
            label_nom_cliente.Hide();
            label142.Hide();
            radiobutton_cliente.Hide();
            radiobutton_fecha.Hide();
            checkbutton_todos_los_clientes.Hide();
            entry_referencia_inicial.Hide();
            entry_cliente.Hide();
            button_busca_cliente.Hide();
        }
Example #14
0
        void Install(HBox labelBox, Button installButton, Update update)
        {
            if (update.InstallAction == null)
            {
                DesktopService.ShowUrl(update.Url);
                return;
            }

            installButton.Hide();

            if (installing)
            {
                Gtk.Label lab = new Gtk.Label(GettextCatalog.GetString("Waiting"));
                labelBox.PackStart(lab, false, false, 0);
                lab.Show();
                installQueue.Enqueue(delegate {
                    lab.Hide();
                    RunInstall(labelBox, update);
                });
                return;
            }

            RunInstall(labelBox, update);
        }
Example #15
0
        private void ShowAdd1Page()
        {
            this.Present();
            Header = CmisSync.Properties_Resources.Where;

            VBox layout_vertical   = new VBox (false, 12);
            HBox layout_fields     = new HBox (true, 12);
            VBox layout_address    = new VBox (true, 0);
            HBox layout_address_help = new HBox(false, 3);
            VBox layout_user       = new VBox (true, 0);
            VBox layout_password   = new VBox (true, 0);

            // Address
            Label address_label = new Label()
            {
                UseMarkup = true,
                          Xalign = 0,
                          Markup = "<b>" + 
                              CmisSync.Properties_Resources.EnterWebAddress +
                              "</b>"
            };

            Entry address_entry = new Entry () {
                Text = (Controller.PreviousAddress == null || String.IsNullOrEmpty(Controller.PreviousAddress.ToString()))?"https://":Controller.PreviousAddress.ToString(),
                     ActivatesDefault = false
            };

            Label address_help_label = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"#808080\" size=\"small\">" +
                           CmisSync.Properties_Resources.Help + ": " +
                           "</span>"
            };
            EventBox address_help_urlbox = new EventBox();
            Label address_help_urllabel = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"blue\" underline=\"single\" size=\"small\">" +
                           CmisSync.Properties_Resources.WhereToFind +
                           "</span>"
            };
            address_help_urlbox.Add(address_help_urllabel);
            address_help_urlbox.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                Process process = new Process();
                process.StartInfo.FileName  = "xdg-open";
                process.StartInfo.Arguments = "https://github.com/aegif/CmisSync/wiki/What-address";
                process.Start ();
            };
            address_help_urlbox.EnterNotifyEvent += delegate(object o, EnterNotifyEventArgs args) {
                address_help_urlbox.GdkWindow.Cursor = hand_cursor;
            };

            Label address_error_label = new Label()
            {
                Xalign = 0,
                UseMarkup = true,
                Markup = ""
            };
            address_error_label.Hide();

            // User
            Entry user_entry = new Entry () {
                Text = Controller.PreviousPath,
                     ActivatesDefault = false
            };

            if(String.IsNullOrEmpty(Controller.saved_user))
            {
                user_entry.Text = Environment.UserName;
            }
            else
            {
                user_entry.Text = Controller.saved_user;
            }

            // Password
            Entry password_entry = new Entry () {
                Visibility = false,
                ActivatesDefault = true
            };

            Controller.ChangeAddressFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        address_entry.Text      = text;
                        });
            };

            Controller.ChangeUserFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        user_entry.Text      = text;
                        });
            };

            Controller.ChangePasswordFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        password_entry.Text      = text;
                        });
            };

            address_entry.Changed += delegate {
                string error = Controller.CheckAddPage(address_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    address_error_label.Markup = "<span foreground=\"red\">" + CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                } else {
                    address_error_label.Hide();
                }
            };

            // Address
            layout_address_help.PackStart(address_help_label, false, false, 0);
            layout_address_help.PackStart(address_help_urlbox, false, false, 0);
            layout_address.PackStart (address_label, true, true, 0);
            layout_address.PackStart (address_entry, true, true, 0);
            layout_address.PackStart (layout_address_help, true, true, 0);
//            layout_address.PackStart (address_error_label, true, true, 0);

            // User
            layout_user.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.User + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_user.PackStart (user_entry, false, false, 0);

            // Password
            layout_password.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.Password + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_password.PackStart (password_entry, false, false, 0);

            layout_fields.PackStart (layout_user);
            layout_fields.PackStart (layout_password);

//            layout_vertical.PackStart (new Label (""), false, false, 0);
            layout_vertical.PackStart (layout_address, false, false, 0);
            layout_vertical.PackStart (layout_fields, false, false, 0);
            layout_vertical.PackStart (address_error_label, true, true, 0);

            Add (layout_vertical);

            // Cancel button
            Button cancel_button = new Button (cancelText);

            cancel_button.Clicked += delegate {
                Controller.PageCancelled ();
            };

            // Continue button
            Button continue_button = new Button (continueText) {
                Sensitive = String.IsNullOrEmpty( Controller.CheckAddPage (address_entry.Text))
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = wait_cursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesFuzzyDelegate dlgt =
                    new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
                ServerCredentials credentials = new ServerCredentials() {
                    UserName = user_entry.Text,
                    Password = password_entry.Text,
                    Address = new Uri(address_entry.Text)
                };
                IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }
                Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar);
                CmisServer cmisServer = result.Item1;
                if(cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                    address_entry.Text = cmisServer.Url.ToString();
                }
                else
                {
                    Controller.repositories = null;
                }
                // Hide wait cursor
                this.GdkWindow.Cursor = default_cursor;

                if (Controller.repositories == null)
                {
                    // Show warning
                    string warning = "";
                    string message = result.Item2.Message;
                    Exception e = result.Item2;
                    if (e is CmisPermissionDeniedException)
                    {
                        warning = Properties_Resources.LoginFailedForbidden;
                    }
//                    else if (e is CmisServerNotFoundException)
//                    {
//                        warning = Properties_Resources.ConnectFailure;
//                    }
                    else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https"))
                    {
                        warning = Properties_Resources.SendFailureHttps;
                    }
                    else if (e.Message == "TrustFailure")
                    {
                        warning = Properties_Resources.TrustFailure;
                    }
                    else
                    {
                        warning = message + Environment.NewLine + Properties_Resources.Sorry;
                    }
                    address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
                    address_error_label.Show();
                }
                else
                {
                    // Continue to folder selection
                    Controller.Add1PageCompleted(
                            new Uri(address_entry.Text), user_entry.Text, password_entry.Text);
                }
            };

            Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                Application.Invoke (delegate {
                    continue_button.Sensitive = button_enabled;
                    if(button_enabled) {
                        continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
                        continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
                        continue_button.GrabDefault();
                    }
                });
            };

            AddButton (cancel_button);
            AddButton (continue_button);

            Controller.CheckAddPage (address_entry.Text);
            address_entry.GrabFocus ();
        }
Example #16
0
 private Widget UserInfoBox()
 {
     VBox userInfo = new VBox(false, 0);
        string lable = null;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Server: {0}"),lable);
       labeliFolderServer = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderServer, false, false, 0);
       labeliFolderServer.UseMarkup = true;
        labeliFolderServer.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderServer.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Last Successfull Sync time: {0}"),lable);
       labelLastSyncTime = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labelLastSyncTime, false, false, 0);
       labelLastSyncTime.UseMarkup = true;
        labelLastSyncTime.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelLastSyncTime.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("File/Folder to synchronize: {0}"),lable);
       labelFolderToSync = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labelFolderToSync, false, false, 0);
       labelFolderToSync.UseMarkup = true;
        labelFolderToSync.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelFolderToSync.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("iFolder Size: {0}"),lable);
       labeliFolderSize = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderSize, false, false, 0);
       labeliFolderSize.UseMarkup = true;
        labeliFolderSize.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderSize.Xalign = 0.0F;
        labeliFolderSize.Hide();
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("iFolder Type: {0}"),lable);
       labeliFolderType = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderType, false, false, 0);
       labeliFolderType.UseMarkup = true;
        labeliFolderType.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderType.Xalign = 0.0F;
        labeliFolderType.Hide();
        return userInfo;
 }
Example #17
0
        public void SyncStateChanged(SyncState state)
        {
            // This event handler will be called by the synchronization thread
            // so we have to use the delegate here to manipulate the GUI.
            Gtk.Application.Invoke(delegate {
                // FIXME: Change these strings to be user-friendly
                switch (state)
                {
                case SyncState.AcquiringLock:
                    ProgressText = Catalog.GetString("Acquiring sync lock...");
                    break;

                case SyncState.CommittingChanges:
                    ProgressText = Catalog.GetString("Committing changes...");
                    break;

                case SyncState.Connecting:
                    Title       = Catalog.GetString("Synchronizing Notes");
                    HeaderText  = Catalog.GetString("Synchronizing your notes...");
                    MessageText = Catalog.GetString("This may take a while, kick back and enjoy!");
                    model.Clear();
                    ProgressText         = Catalog.GetString("Connecting to the server...");
                    progressBar.Fraction = 0;
                    progressBar.Show();
                    progressLabel.Show();
                    break;

                case SyncState.DeleteServerNotes:
                    ProgressText = Catalog.GetString("Deleting notes off of the server...");
                    progressBar.Pulse();
                    break;

                case SyncState.Downloading:
                    ProgressText = Catalog.GetString("Downloading new/updated notes...");
                    progressBar.Pulse();
                    break;

                case SyncState.Idle:
                    GLib.Source.Remove(progressBarTimeoutId);
                    progressBarTimeoutId = 0;
                    progressBar.Fraction = 0;
                    progressBar.Hide();
                    progressLabel.Hide();
                    closeButton.Sensitive = true;
                    break;

                case SyncState.Locked:
                    Title        = Catalog.GetString("Server Locked");
                    HeaderText   = Catalog.GetString("Server is locked");
                    MessageText  = Catalog.GetString("One of your other computers is currently synchronizing.  Please wait 2 minutes and try again.");
                    ProgressText = string.Empty;
                    break;

                case SyncState.PrepareDownload:
                    ProgressText = Catalog.GetString("Preparing to download updates from server...");
                    break;

                case SyncState.PrepareUpload:
                    ProgressText = Catalog.GetString("Preparing to upload updates to server...");
                    break;

                case SyncState.Uploading:
                    ProgressText = Catalog.GetString("Uploading notes to server...");
                    break;

                case SyncState.Failed:
                    Title        = Catalog.GetString("Synchronization Failed");
                    HeaderText   = Catalog.GetString("Failed to synchronize");
                    MessageText  = Catalog.GetString("Could not synchronize notes.  Check the details below and try again.");
                    ProgressText = string.Empty;
                    break;

                case SyncState.Succeeded:
                    int count              = 0;
                    count                 += model.IterNChildren();
                    Title                  = Catalog.GetString("Synchronization Complete");
                    HeaderText             = Catalog.GetString("Synchronization is complete");
                    string numNotesUpdated =
                        string.Format(Catalog.GetPluralString("{0} note updated.",
                                                              "{0} notes updated.",
                                                              count),
                                      count);
                    MessageText = numNotesUpdated + "  " +
                                  Catalog.GetString("Your notes are now up to date.");
                    ProgressText = string.Empty;
                    break;

                case SyncState.UserCancelled:
                    Title        = Catalog.GetString("Synchronization Canceled");
                    HeaderText   = Catalog.GetString("Synchronization was canceled");
                    MessageText  = Catalog.GetString("You canceled the synchronization.  You may close the window now.");
                    ProgressText = string.Empty;
                    break;

                case SyncState.NoConfiguredSyncService:
                    Title        = Catalog.GetString("Synchronization Not Configured");
                    HeaderText   = Catalog.GetString("Synchronization is not configured");
                    MessageText  = Catalog.GetString("Please configure synchronization in the preferences dialog.");
                    ProgressText = string.Empty;
                    break;

                case SyncState.SyncServerCreationFailed:
                    Title        = Catalog.GetString("Synchronization Service Error");
                    HeaderText   = Catalog.GetString("Service error");
                    MessageText  = Catalog.GetString("Error connecting to the synchronization service.  Please try again.");
                    ProgressText = string.Empty;
                    break;
                }
            });
        }
Example #18
0
        private void ShowCustomizePage()
        {
            Header = CmisSync.Properties_Resources.ResourceManager.GetString("Customize", CultureInfo.CurrentCulture);

            Label localfolder_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("EnterLocalFolderName", CultureInfo.CurrentCulture) + "</b>"
            };

            Entry localfolder_entry = new Entry() {
                Text = Controller.SyncingReponame,
                     ActivatesDefault = false
            };

            Label localrepopath_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("ChangeRepoPath", CultureInfo.CurrentCulture) + "</b>"
            };

            Entry localrepopath_entry = new Entry() {
                Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text)
            };

            localfolder_entry.Changed += delegate {
                localrepopath_entry.Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text);
            };

            Label localfolder_error_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = ""
            };

            Button cancel_button = new Button(cancelText);

            Button add_button = new Button(
                    CmisSync.Properties_Resources.ResourceManager.GetString("Add", CultureInfo.CurrentCulture)
                    );

            Button back_button = new Button(
                    CmisSync.Properties_Resources.ResourceManager.GetString("Back", CultureInfo.CurrentCulture)
                    );

            Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Gtk.Application.Invoke(delegate {
                        add_button.Sensitive = button_enabled;
                        });
            };

            string error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error)) {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                    CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                    "</span>";
                localfolder_error_label.Show();
            } else {
                localfolder_error_label.Hide();
            }

            localfolder_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                        CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                        "</span>";
                    localfolder_error_label.Show();
                } else {
                    localfolder_error_label.Hide();
                }
            };

            error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error)) {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                    CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                "</span>";
                localfolder_error_label.Show();
            } else {
                localfolder_error_label.Hide();
            }

            localrepopath_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                        CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                        "</span>";
                    localfolder_error_label.Show();
                } else {
                    localfolder_error_label.Hide();
                }
            };

            cancel_button.Clicked += delegate {
                Controller.PageCancelled();
            };

            back_button.Clicked += delegate {
                Controller.BackToPage2();
            };

            add_button.Clicked += delegate {
                Controller.CustomizePageCompleted(localfolder_entry.Text, localrepopath_entry.Text);
            };

            VBox layout_vertical   = new VBox (false, 12);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (localfolder_label, true, true, 0);
            layout_vertical.PackStart (localfolder_entry, true, true, 0);
            layout_vertical.PackStart (localrepopath_label, true, true, 0);
            layout_vertical.PackStart (localrepopath_entry, true, true, 0);
            layout_vertical.PackStart (localfolder_error_label, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(add_button);
            AddButton(cancel_button);

            // add_button.GrabFocus();
            localfolder_entry.GrabFocus();
            localfolder_entry.SelectRegion(0, localfolder_entry.Text.Length);

        }
Example #19
0
        private void ShowAdd1Page() {
            this.Present();
            this.Header = Properties_Resources.Where;

            VBox layout_vertical   = new VBox(false, 12);
            HBox layout_fields     = new HBox(true, 12);
            VBox layout_address    = new VBox(true, 0);
            HBox layout_address_help = new HBox(false, 3);
            VBox layout_user       = new VBox(true, 0);
            VBox layout_password   = new VBox(true, 0);

            // Address
            Label address_label = new Label() {
                UseMarkup = true,
                Xalign = 0,
                Markup = "<b>" +
                Properties_Resources.EnterWebAddress +
                "</b>"
            };

            Entry address_entry = new Entry() {
                Text = (this.controller.PreviousAddress == null || string.IsNullOrEmpty(this.controller.PreviousAddress.ToString())) ? DefaultEntries.Defaults.Url : this.controller.PreviousAddress.ToString(),
                IsEditable = DefaultEntries.Defaults.CanModifyUrl,
                ActivatesDefault = false
            };

            Label address_help_label = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = "<span foreground=\"#808080\" size=\"small\">" +
                Properties_Resources.Help + ": " +
                "</span>"
            };
            EventBox address_help_urlbox = new EventBox();
            Label address_help_urllabel = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = "<span foreground=\"blue\" underline=\"single\" size=\"small\">" +
                Properties_Resources.WhereToFind +
                "</span>"
            };
            address_help_urlbox.Add(address_help_urllabel);
            address_help_urlbox.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                Process process = new Process();
                process.StartInfo.FileName  = "xdg-open";
                process.StartInfo.Arguments = "https://github.com/nicolas-raoul/CmisSync/wiki/What-address";
                process.Start();
            };
            address_help_urlbox.EnterNotifyEvent += delegate(object o, EnterNotifyEventArgs args) {
                address_help_urlbox.GdkWindow.Cursor = handCursor;
            };

            Label address_error_label = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = string.Empty
            };
            address_error_label.Hide();

            // User
            Entry user_entry = new Entry() {
                Text = this.controller.PreviousPath,
                ActivatesDefault = false
            };

            if (string.IsNullOrEmpty(this.controller.saved_user)) {
                user_entry.Text = DefaultEntries.Defaults.Name;
            } else {
                user_entry.Text = this.controller.saved_user;
            }

            // Password
            Entry password_entry = new Entry() {
                Visibility = false,
                ActivatesDefault = true
            };

            this.controller.ChangeAddressFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    address_entry.Text = text;
                });
            };

            this.controller.ChangeUserFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    user_entry.Text = text;
                });
            };

            this.controller.ChangePasswordFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    password_entry.Text = text;
                });
            };

            address_entry.Changed += delegate {
                string error = this.controller.CheckAddPage(address_entry.Text);
                if (!string.IsNullOrEmpty(error)) {
                    address_error_label.Markup = "<span foreground=\"red\">" + Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                } else {
                    address_error_label.Hide();
                }
            };

            // Address
            layout_address_help.PackStart(address_help_label, false, false, 0);
            layout_address_help.PackStart(address_help_urlbox, false, false, 0);
            layout_address.PackStart(address_label, true, true, 0);
            layout_address.PackStart(address_entry, true, true, 0);
            layout_address.PackStart(layout_address_help, true, true, 0);

            // User
            layout_user.PackStart(
                new Label() {
                Markup = "<b>" + Properties_Resources.User + ":</b>",
                Xalign = 0
            },
            true,
            true,
            0);
            layout_user.PackStart(user_entry, false, false, 0);

            // Password
            layout_password.PackStart(
                new Label() {
                Markup = "<b>" + Properties_Resources.Password + ":</b>",
                Xalign = 0
            },
            true,
            true,
            0);
            layout_password.PackStart(password_entry, false, false, 0);
            layout_fields.PackStart(layout_user);
            layout_fields.PackStart(layout_password);
            layout_vertical.PackStart(layout_address, false, false, 0);
            layout_vertical.PackStart(layout_fields, false, false, 0);
            layout_vertical.PackStart(address_error_label, true, true, 0);
            this.Add(layout_vertical);

            // Cancel button
            Button cancel_button = new Button(this.cancelText);

            cancel_button.Clicked += delegate {
                this.controller.PageCancelled();
            };

            // Continue button
            Button continue_button = new Button(this.continueText) {
                Sensitive = string.IsNullOrEmpty(this.controller.CheckAddPage(address_entry.Text))
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = waitCursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesDelegate dlgt =
                    new GetRepositoriesDelegate(SetupController.GetRepositories);
                ServerCredentials credentials = new ServerCredentials() {
                    UserName = user_entry.Text,
                    Password = password_entry.Text,
                    Address = new Uri(address_entry.Text),
                    Binding = this.controller.saved_binding ?? ServerCredentials.BindingBrowser
                };
                IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }

                var result = dlgt.EndInvoke(ar);
                if (result.Repositories != null) {
                    this.controller.repositories = result.Repositories.WithoutHiddenOnce();
                    address_entry.Text = result.Credentials.Address.ToString();
                } else {
                    this.controller.repositories = null;

                    // Show best found Url
                    address_entry.Text = result.Credentials.Address.ToString();

                    // Show warning
                    string warning = this.controller.GetConnectionsProblemWarning(result.FailedException);
                    address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
                    address_error_label.Show();
                }

                // Hide wait cursor
                this.GdkWindow.Cursor = defaultCursor;

                if (this.controller.repositories != null) {
                    // Continue to folder selection
                    this.controller.Add1PageCompleted(
                        new Uri(address_entry.Text), result.Credentials.Binding, user_entry.Text, password_entry.Text);
                }
            };

            this.controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Application.Invoke(delegate {
                    continue_button.Sensitive = button_enabled;
                    if (button_enabled) {
                        continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
                        continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
                        continue_button.GrabDefault();
                    }
                });
            };

            this.AddButton(cancel_button);
            this.AddButton(continue_button);

            this.controller.CheckAddPage(address_entry.Text);
            address_entry.GrabFocus();
        }
Example #20
0
        private void ShowAdd1Page()
        {

            Header = CmisSync.Properties_Resources.ResourceManager.GetString("Where", CultureInfo.CurrentCulture);

            VBox layout_vertical   = new VBox (false, 12);
            HBox layout_fields     = new HBox (true, 12);
            VBox layout_address    = new VBox (true, 0);
            HBox layout_address_help = new HBox(false, 3);
            VBox layout_user       = new VBox (true, 0);
            VBox layout_password   = new VBox (true, 0);

            // Address
            Label address_label = new Label()
            {
                UseMarkup = true,
                          Xalign = 0,
                          Markup = "<b>" + 
                              CmisSync.Properties_Resources.ResourceManager.GetString("EnterWebAddress", CultureInfo.CurrentCulture) +
                              "</b>"
            };

            Entry address_entry = new Entry () {
                Text = Controller.PreviousAddress,
                     ActivatesDefault = false
            };

            Label address_help_label = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"#808080\" size=\"small\">" +
                           CmisSync.Properties_Resources.ResourceManager.GetString("Help", CultureInfo.CurrentCulture) + ": " +
                           "</span>"
            };
            EventBox address_help_urlbox = new EventBox();
            Label address_help_urllabel = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"blue\" underline=\"single\" size=\"small\">" +
                           CmisSync.Properties_Resources.ResourceManager.GetString("WhereToFind", CultureInfo.CurrentCulture) +
                           "</span>"
            };
            address_help_urlbox.Add(address_help_urllabel);
            address_help_urlbox.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                Process process = new Process();
                process.StartInfo.FileName  = "xdg-open";
                process.StartInfo.Arguments = "https://github.com/nicolas-raoul/CmisSync/wiki/What-address";
                process.Start ();
            };
            address_help_urlbox.EnterNotifyEvent += delegate(object o, EnterNotifyEventArgs args) {
                address_help_urlbox.GdkWindow.Cursor = hand_cursor;
            };

            Label address_error_label = new Label()
            {
                Xalign = 0,
                UseMarkup = true,
                Markup = ""
            };
            address_error_label.Hide();

            // User
            Entry user_entry = new Entry () {
                Text = Controller.PreviousPath,
                     ActivatesDefault = false
            };

            // Password
            Entry password_entry = new Entry () {
                Text = Controller.PreviousPath,
                     Visibility = false,
                     ActivatesDefault = true
            };

            Controller.ChangeAddressFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        address_entry.Text      = text;
                        });
            };

            Controller.ChangeUserFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        user_entry.Text      = text;
                        });
            };

            Controller.ChangePasswordFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        password_entry.Text      = text;
                        });
            };

            address_entry.Changed += delegate {
                string error = Controller.CheckAddPage(address_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    address_error_label.Markup = "<span foreground=\"red\">" + CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                } else {
                    address_error_label.Hide();
                }
            };

            // Address
            layout_address_help.PackStart(address_help_label, false, false, 0);
            layout_address_help.PackStart(address_help_urlbox, false, false, 0);
            layout_address.PackStart (address_label, true, true, 0);
            layout_address.PackStart (address_entry, true, true, 0);
            layout_address.PackStart (layout_address_help, true, true, 0);
            layout_address.PackStart (address_error_label, true, true, 0);

            // User
            layout_user.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("User", CultureInfo.CurrentCulture) + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_user.PackStart (user_entry, false, false, 0);

            // Password
            layout_password.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("Password", CultureInfo.CurrentCulture) + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_password.PackStart (password_entry, false, false, 0);

            layout_fields.PackStart (layout_user);
            layout_fields.PackStart (layout_password);

            layout_vertical.PackStart (new Label (""), false, false, 0);
            layout_vertical.PackStart (layout_address, false, false, 0);
            layout_vertical.PackStart (layout_fields, false, false, 0);

            Add (layout_vertical);

            // Cancel button
            Button cancel_button = new Button (cancelText);

            cancel_button.Clicked += delegate {
                Controller.PageCancelled ();
            };

            // Continue button
            Button continue_button = new Button (continueText) {
                Sensitive = false
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = wait_cursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesFuzzyDelegate dlgt =
                    new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
                IAsyncResult ar = dlgt.BeginInvoke(new Uri(address_entry.Text), user_entry.Text,
                        password_entry.Text, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }
                CmisServer cmisServer = dlgt.EndInvoke(ar);

                Controller.repositories = cmisServer.Repositories;
                address_entry.Text = cmisServer.Url.ToString();

                // Hide wait cursor
                this.GdkWindow.Cursor = default_cursor;

                if (Controller.repositories == null)
                {
                    // Show warning
                    address_error_label.Markup = "<span foreground=\"red\">" + CmisSync.Properties_Resources.ResourceManager.GetString("Sorry", CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                }
                else
                {
                    // Continue to folder selection
                    Controller.Add1PageCompleted(
                            address_entry.Text, user_entry.Text, password_entry.Text);
                }
            };

            Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                Application.Invoke (delegate {
                        continue_button.Sensitive = button_enabled;                            
                        });
            };

            AddButton (continue_button);
            AddButton (cancel_button);

            address_entry.GrabFocus();
        }
Example #21
0
    private void on_combo_sports_changed(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        //LogB.Information("changed");
        try {
            int sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports));
            sport = SqliteSport.Select(false, sportID);

            if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportAny))
            {
                //if sport is undefined, level should be undefined, and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                    combo_levels.Sensitive     = false;
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportNone))
            {
                //if sport is none, level should be sedentary and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelSedentaryID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelSedentary));
                    combo_levels.Sensitive = false;

                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));

                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else
            {
                //sport is not undefined and not none

                //if level is "sedentary", then change level to "undefined"
                if (UtilGtk.ComboGetActive(combo_levels) ==
                    Constants.LevelSedentaryID.ToString() + ":" +
                    Catalog.GetString(Constants.LevelSedentary))
                {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                }

                //show level
                combo_levels.Sensitive = true;

                if (sport.HasSpeciallities)
                {
                    combo_speciallities.Destroy();
                    createComboSpeciallities(sport.UniqueID);
                    label_speciallity.Show();
                    combo_speciallities.Show();
                }
                else
                {
                    LogB.Information("hide");
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
            }
        } catch {
            //LogB.Warning("do later");
        }

        on_entries_required_changed(new object(), new EventArgs());
        LogB.Information(sport.ToString());
    }
Example #22
0
    protected void fillDialog(Event myEvent)
    {
        fillWindowTitleAndLabelHeader();

        string id = myEvent.UniqueID.ToString();

        if (myEvent.Simulated == Constants.Simulated)
        {
            label_simulated.Show();
        }

        label_event_id_value.Text      = id;
        label_event_id_value.UseMarkup = true;

        if (showTv)
        {
            fillTv(myEvent);
        }
        else
        {
            label_tv_title.Hide();
            entry_tv_value.Hide();
            label_tv_units.Hide();
        }

        if (showTc)
        {
            fillTc(myEvent);
        }
        else
        {
            label_tc_title.Hide();
            entry_tc_value.Hide();
            label_tc_units.Hide();
        }

        if (showFall)
        {
            fillFall(myEvent);
        }
        else
        {
            label_fall_title.Hide();
            entry_fall_value.Hide();
            label_fall_units.Hide();
        }

        if (showDistance)
        {
            fillDistance(myEvent);
        }
        else
        {
            label_distance_title.Hide();
            entry_distance_value.Hide();
            label_distance_units.Hide();
        }

        if (showTime)
        {
            fillTime(myEvent);
        }
        else
        {
            label_time_title.Hide();
            entry_time_value.Hide();
            label_time_units.Hide();
        }

        if (showSpeed)
        {
            fillSpeed(myEvent);
        }
        else
        {
            label_speed_title.Hide();
            label_speed_value.Hide();
            label_speed_units.Hide();
        }

        if (showWeight)
        {
            fillWeight(myEvent);
        }
        else
        {
            label_weight_title.Hide();
            entry_weight_value.Hide();
            label_weight_units.Hide();
        }

        if (showLimited)
        {
            fillLimited(myEvent);
        }
        else
        {
            label_limited_title.Hide();
            label_limited_value.Hide();
        }

        if (showAngle)
        {
            fillAngle(myEvent);
        }
        else
        {
            label_angle_title.Hide();
            entry_angle_value.Hide();
            label_angle_units.Hide();
        }

        if (!showMistakes)
        {
            label_mistakes.Hide();
            spin_mistakes.Hide();
        }


        //also remove new line for old descriptions that used a textview
        string temp = Util.RemoveTildeAndColonAndDot(myEvent.Description);

        entry_description.Text = Util.RemoveNewLine(temp, true);

        createComboEventType(myEvent);

        if (!showType)
        {
            label_type_title.Hide();
            combo_eventType.Hide();
        }

        if (showRunStart)
        {
            fillRunStart(myEvent);
        }
        else
        {
            label_run_start_title.Hide();
            label_run_start_value.Hide();
        }

        ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
            myEvent.SessionID,
            false);                     //means: do not returnPersonAndPSlist

        string [] personsStrings = new String[persons.Count];
        int       i = 0;

        foreach (Person person in persons)
        {
            personsStrings[i++] = person.IDAndName(":");
        }

        combo_persons = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_persons, personsStrings, "");
        combo_persons.Active = UtilGtk.ComboMakeActive(personsStrings, myEvent.PersonID + ":" + myEvent.PersonName);

        oldPersonID = myEvent.PersonID;

        hbox_combo_person.PackStart(combo_persons, true, true, 0);
        hbox_combo_person.ShowAll();

        //show video if available
        videoFileName = Util.GetVideoFileName(myEvent.SessionID, typeOfTest, myEvent.UniqueID);
        if (File.Exists(videoFileName))
        {
            label_video_yes.Visible      = true;
            label_video_no.Visible       = false;
            button_video_watch.Sensitive = true;
            button_video_url.Sensitive   = true;
        }
        else
        {
            label_video_yes.Visible      = false;
            label_video_no.Visible       = true;
            button_video_watch.Sensitive = false;
            button_video_url.Sensitive   = false;
        }
    }
Example #23
0
		void Install (Gtk.Alignment commandBox, Button installButton, Update update)
		{
			if (update.InstallAction == null) {
				DesktopService.ShowUrl (update.Url);
				return;
			}
			
			installButton.Hide ();
			
			if (installing) {
				Gtk.Label lab = new Gtk.Label (GettextCatalog.GetString ("Waiting"));
				commandBox.Child.Destroy ();
				commandBox.Add (lab);
				lab.Show ();
				installQueue.Enqueue (delegate {
					lab.Hide ();
					RunInstall (commandBox, update);
				});
				return;
			}
			
			RunInstall (commandBox, update);
		}
Example #24
0
		void Install (HBox labelBox, Button installButton, Update update)
		{
			if (update.InstallAction == null) {
				DesktopService.ShowUrl (update.Url);
				return;
			}
			
			installButton.Hide ();
			
			if (installing) {
				Gtk.Label lab = new Gtk.Label (GettextCatalog.GetString ("Waiting"));
				labelBox.PackStart (lab, false, false, 0);
				lab.Show ();
				installQueue.Enqueue (delegate {
					lab.Hide ();
					RunInstall (labelBox, update);
				});
				return;
			}
			
			RunInstall (labelBox, update);
		}
Example #25
0
        private void ShowCustomizePage()
        {
            Header = CmisSync.Properties_Resources.Customize;
            string localfoldername = Controller.saved_address.Host.ToString();
            foreach (KeyValuePair<String, String> repository in Controller.repositories)
            {
                                    if (repository.Key == Controller.saved_repository)
                                    {
                                        localfoldername += "/" + repository.Value;
                                        break;
                                    }
            }
            Label localfolder_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<b>" + CmisSync.Properties_Resources.EnterLocalFolderName + "</b>"
            };

            Entry localfolder_entry = new Entry() {
                Text = localfoldername,
                     ActivatesDefault = false
            };

            Label localrepopath_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<b>" + CmisSync.Properties_Resources.ChangeRepoPath + "</b>"
            };

            Entry localrepopath_entry = new Entry() {
                Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text)
            };

            localfolder_entry.Changed += delegate {
                try{
                    localrepopath_entry.Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text);
                }catch(Exception){}
            };

            Label localfolder_error_label = new Label() {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = ""
            };

            Button cancel_button = new Button(cancelText);

            Button add_button = new Button(
                    CmisSync.Properties_Resources.Add
                    );

            Button back_button = new Button(
                    CmisSync.Properties_Resources.Back
                    );

            Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Gtk.Application.Invoke(delegate {
                        add_button.Sensitive = button_enabled;
                        });
            };

            string error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error)) {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                    error +
                    "</span>";
                localfolder_error_label.Show();
            } else {
                localfolder_error_label.Hide();
            }

            localfolder_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                        error +
                        "</span>";
                    localfolder_error_label.Show();
                } else {
                    localfolder_error_label.Hide();
                }
            };

            error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error)) {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                    error +
                "</span>";
                localfolder_error_label.Show();
            } else {
                localfolder_error_label.Hide();
            }

            localrepopath_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                        error +
                        "</span>";
                    localfolder_error_label.Show();
                } else {
                    localfolder_error_label.Hide();
                }
            };

            cancel_button.Clicked += delegate {
                Controller.PageCancelled();
            };

            back_button.Clicked += delegate {
                Controller.BackToPage2();
            };

            add_button.Clicked += delegate {
                Controller.CustomizePageCompleted(localfolder_entry.Text, localrepopath_entry.Text);
            };

            VBox layout_vertical   = new VBox (false, 12);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (localfolder_label, true, true, 0);
            layout_vertical.PackStart (localfolder_entry, true, true, 0);
            layout_vertical.PackStart (localrepopath_label, true, true, 0);
            layout_vertical.PackStart (localrepopath_entry, true, true, 0);
            layout_vertical.PackStart (localfolder_error_label, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(add_button);
            // add_button.GrabFocus();
            localfolder_entry.GrabFocus();
            localfolder_entry.SelectRegion(0, localfolder_entry.Text.Length);

        }
Example #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.StartWindow"/> class.
        /// </summary>
        public StartWindow() : base(Gtk.WindowType.Toplevel)
        {
            #region Basic window properties
            // Basic window properties
            this.Title        = "Scrabble - Základní nastavení";
            this.Name         = "ConfigWindow";
            this.DeleteEvent += OnDeleteEvent;
            this.SetPosition(WindowPosition.Center);
            this.DefaultWidth  = 410;
            this.DefaultHeight = 280;
            this.Icon          = Scrabble.Game.InitialConfig.icon;
            #endregion

            this.numberOfPlayers = 2;

            // Own thread for loading dictionary
            this.statusb = new Gtk.Statusbar();
            this.statusb.Push(statusb.GetContextId("Slovník"), "Načítám slovník");
            this.tdic = new Thread(LoadDictionary);
            this.tdic.Start();

            // infoText (top)
            this.infoText = new Gtk.Label("Základní nastavení hry.\n" +
                                          "Nastavte prosím počet hráčů, jejich jména a určete zda za ně bude hrát umělá inteligence. " +
                                          "Také můžete nastavit, kteří hráči se připojují vzdáleně.");
            this.infoText.Wrap = true;

            // First config line (number of players, client)
            this.upperHbox = new HBox(false, 5);
            this.l1        = new Label("Počet hráčů");
            this.upperHbox.PackStart(l1);
            this.l2                = new Label(", nebo:");
            this.entryNum          = new SpinButton(2, 5, 1);
            this.entryNum.Changed += OnNumberOfPlayerChange;
            client             = new CheckButton();
            client.Clicked    += IamClient;
            client.Label       = "připojit se ke vzdálené hře";
            client.TooltipText = "Pokud zaškrnete, tak se program bude chovat pouze jako client a připojí se k hře vedené na jiném PC.";
            upperHbox.Add(entryNum);
            upperHbox.Add(l2);
            upperHbox.PackEnd(client);
            upperHbox.BorderWidth  = 10;
            upperHbox.WidthRequest = 20;

            // Table with config for each player (dynamic size)
            table = new Gtk.Table(5, 7, false);
            table.Attach(new Gtk.Label("Jméno hráče:"), 1, 2, 0, 1);
            table.Attach(new Gtk.Label("CPU"), 2, 3, 0, 1);
            table.Attach(new Gtk.Label("Network"), 3, 4, 0, 1);
            ipLabel = new Gtk.Label("IP");
            table.Attach(ipLabel, 4, 5, 0, 1);

            labels    = new Gtk.Label[5];
            entryes   = new Gtk.Entry[5];
            CPUchecks = new Gtk.CheckButton[5];
            MPchecks  = new Gtk.CheckButton[5];
            IPs       = new Gtk.Entry[5];
            for (int i = 0; i < 5; i++)
            {
                labels [i]      = new Gtk.Label((i + 1).ToString());
                labels [i].Name = string.Format("l {0}", i);
                table.Attach(labels [i], 0, 1, (uint)i + 1, (uint)i + 2);
                entryes [i]             = new Gtk.Entry(12);
                entryes [i].Text        = "Hráč " + (i + 1).ToString();
                entryes [i].TooltipText = "Vložte jméno hráče.";
                table.Attach(entryes [i], 1, 2, (uint)i + 1, (uint)i + 2);
                CPUchecks [i]             = new Gtk.CheckButton();
                CPUchecks [i].Name        = string.Format("c {0}", i);
                CPUchecks [i].TooltipText = "Pokud je zaškrtnuto, tak za hráče bude hrát počítač.";
                ((Gtk.CheckButton)CPUchecks [i]).Clicked += OnCpuChange;
                table.Attach(CPUchecks [i], 2, 3, (uint)i + 1, (uint)i + 2);
                MPchecks [i]             = new Gtk.CheckButton();
                MPchecks [i].Name        = string.Format("n {0}", i);
                MPchecks [i].TooltipText = "Pokud je zaškrtnuto, tak se počítá s tím, že se tento hráč připojí vzdáleně. ";
                ((Gtk.CheckButton)MPchecks [i]).Clicked += OnNetChange;
                table.Attach(MPchecks [i], 3, 4, (uint)i + 1, (uint)i + 2);
                IPs [i]            = new Gtk.Entry(15);
                IPs [i].Text       = "192.168.0.X";
                IPs [i].WidthChars = 15;
                IPs [i].Sensitive  = false;
                table.Attach(IPs [i], 4, 5, (uint)i + 1, (uint)i + 2);
            }
            this.CPUchecks[0].Hide();

            ok             = new Button("Hotovo");
            ok.Clicked    += Done;
            ok.BorderWidth = 5;
            ok.TooltipText = "Potvrzením začne hra. Může se stát, že program bude ještě chvíli načítat slovník.";
            table.Attach(ok, 0, 5, 6, 7);

            // Main vbox (where all is)
            this.mainVbox = new Gtk.VBox(false, 5);

            this.mainVbox.PackStart(infoText);
            this.mainVbox.Add(upperHbox);
            this.mainVbox.Spacing = 5;
            this.mainVbox.Add(table);
            this.mainVbox.PackEnd(statusb);

            this.mainVbox.BorderWidth = 9;
            this.Add(mainVbox);
            this.mainVbox.ShowAll();

            for (int i = 2; i < numberOfPlayers + 3; i++)
            {
                labels [i].Hide();
                entryes [i].Hide();
                CPUchecks [i].Hide();
                MPchecks [i].Hide();
                IPs [i].Hide();
            }
            ipLabel.Hide();

            foreach (Gtk.Entry e in IPs)
            {
                e.Hide();
            }

            this.CPUchecks[0].Hide();
            this.MPchecks[0].Hide();
        }