Ejemplo n.º 1
0
    void ChkFilesFailed(string text)
    {
        Application.Invoke(delegate
        {
            if (!stopped)
            {
                MessageDialog dlgMsg =
                    new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
                dlgMsg.Run();
                dlgMsg.Destroy();
            }

            prgProgress.Visible      = false;
            btnStop.Visible          = false;
            btnClose.Visible         = false;
            btnExit.Sensitive        = true;
            Workers.Failed          -= ChkFilesFailed;
            Workers.Finished        -= ChkFilesFinished;
            Workers.UpdateProgress  -= UpdateProgress;
            Workers.UpdateProgress2 -= UpdateProgress2;
            Workers.AddFileForOS    -= AddFile;
            Workers.AddOS           -= AddOS;
            thdPulseProgress?.Abort();
            thdCheckFiles?.Abort();
            thdHashFiles = null;
            fileView?.Clear();
            if (osView == null)
            {
                return;
            }

            tabTabs.GetNthPage(1).Visible = false;
            osView.Clear();
        });
    }
Ejemplo n.º 2
0
        protected override void Dispose(bool disposing)
        {
            closeButton.Clicked -= CloseButtonClicked;
            currentPackageVersionLabel.BoundsChanged -= PackageVersionLabelBoundsChanged;

            imageLoader.Loaded -= ImageLoaded;
            imageLoader.Dispose();

            RemoveSelectedPackagePropertyChangedEventHandler();
            viewModel.PropertyChanged -= ViewModelPropertyChanged;
            viewModel.Dispose();
            DisposeExistingTimer();
            DisposePopulatePackageVersionsTimer();
            packageStore.Clear();
            projectStore?.Clear();
            viewModel = null;

            base.Dispose(disposing);
        }
        void FillRepos()
        {
            int i = repoCombo.Active;

            repoStore.Clear();

            repoStore.AppendValues(Catalog.GetString("All repositories"), AllRepoMarker);

            foreach (AddinRepository rep in service.Repositories.GetRepositories())
            {
                if (rep.Enabled)
                {
                    repoStore.AppendValues(rep.Title, rep.Url);
                }
            }
            repoStore.AppendValues("---", "");
            repoStore.AppendValues(Catalog.GetString("Manage Repositories..."), ManageRepoMarker);
            repoCombo.Active = i;
        }
Ejemplo n.º 4
0
        void on_buscar_ordencompra_clicked(object sender, EventArgs args)
        {
            treeViewEngineordendecompra.Clear();
            if (checkbutton_todos_envios.Active == true)
            {
                query_fechas = " ";
            }
            else
            {
                query_fechas = "AND to_char(osiris_erp_ordenes_compras_enca.fechahora_creacion,'yyyy-MM-dd') >= '" + (string)entry_ano_inicio.Text.ToString() + "-" + (string)entry_mes_inicio.Text.ToString() + "-" + (string)entry_dia_inicio.Text.ToString() + "' " +
                               "AND to_char(osiris_erp_ordenes_compras_enca.fechahora_creacion,'yyyy-MM-dd') <= '" + (string)entry_ano_termino.Text.ToString() + "-" + (string)entry_mes_termino.Text.ToString() + "-" + (string)entry_dia_termino.Text.ToString() + "' ";
            }

            NpgsqlConnection conexion;

            conexion = new NpgsqlConnection(connectionString + nombrebd);
            try{
                conexion.Open();
                NpgsqlCommand comando;
                comando             = conexion.CreateCommand();
                comando.CommandText = "SELECT numero_orden_compra,osiris_erp_ordenes_compras_enca.id_proveedor,osiris_erp_ordenes_compras_enca.descripcion_proveedor," +
                                      "to_char(fechahora_creacion,'yyyy-MM-dd') AS fechahoracreacion " +
                                      "FROM osiris_erp_ordenes_compras_enca,osiris_erp_proveedores " +
                                      "WHERE osiris_erp_ordenes_compras_enca.id_proveedor = osiris_erp_proveedores.id_proveedor " +
                                      query_fechas + ";";
                //Console.WriteLine(comando.CommandText);
                NpgsqlDataReader lector = comando.ExecuteReader();
                while (lector.Read())
                {
                    treeViewEngineordendecompra.AppendValues(false,
                                                             lector["numero_orden_compra"].ToString().Trim(),
                                                             lector["fechahoracreacion"].ToString(),
                                                             lector["id_proveedor"].ToString().Trim(),
                                                             lector["descripcion_proveedor"].ToString().Trim());
                }
            }catch (NpgsqlException ex) {
                MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent,
                                                              MessageType.Warning, ButtonsType.Ok, "PostgresSQL error: {0}", ex.Message);
                msgBoxError.Run();
                msgBoxError.Destroy();
            }
            conexion.Close();
        }
        void FillWidgets()
        {
            store.Clear();
            widgets.Clear();

            Stetic.Wrapper.Widget widget = Stetic.Wrapper.Widget.Lookup(obj);
            if (widget == null)
            {
                return;
            }

            while (!widget.IsTopLevel)
            {
                widget = widget.ParentWrapper;
            }

            store.AppendValues(null, "(None)");
            FillWidgets(widget, 0);
        }
Ejemplo n.º 6
0
    protected void searchButtonClicked(object sender, EventArgs e)
    {
        var dbCon = DBConnection.Instance();

        dbCon.DatabaseName = "ShopProducts";
        if (dbCon.IsConnect())
        {
            string query = "";
            if (entry1.Text.Equals(""))
            {
                query = "SELECT ProductType, CompanyProducer, ProductPrice FROM ShopProducts ORDER BY ProductType";
            }
            else if (combobox1.ActiveText == "Search by product type")
            {
                query = $"SELECT ProductType, CompanyProducer, ProductPrice FROM ShopProducts WHERE ProductType LIKE '%{entry1.Text}%' ORDER BY ProductType";
            }
            else if (combobox1.ActiveText == "Search by company-producer")
            {
                query = $"SELECT ProductType, CompanyProducer, ProductPrice FROM ShopProducts WHERE CompanyProducer LIKE '%{entry1.Text}%' ORDER BY ProductType";
            }
            var cmd    = new MySqlCommand(query, dbCon.Connection);
            var reader = cmd.ExecuteReader();

            prodListStore.Clear();
            prodOrdList.Clear();

            TreeViewColumn productTypeColumn = null, companyProducerColumn = null, productPriceColumn = null;

            if (searchButtonClicksCounter == 0)
            {
                treeviewPrepare(productTypeColumn, companyProducerColumn, productPriceColumn);
            }

            while (reader.Read())
            {
                prodListStore.AppendValues(reader.GetString(0), reader.GetString(1), reader.GetString(2));
                prodOrdList.Add(reader.GetString(0) + " " + reader.GetString(1) + " " + reader.GetString(2));
                priceList.Add(Convert.ToDouble(reader.GetString(2)));
            }
            dbCon.Close();
            searchButtonClicksCounter++;
        }
    }
Ejemplo n.º 7
0
        private void RebuildDocumentList()
        {
            // Ensure that the old image previews are disposed.
            foreach (object[] row in store)
            {
                var imageSurface = (Cairo.ImageSurface)row[FilePreviewColumnIndex];
                (imageSurface as IDisposable).Dispose();
            }

            store.Clear();

            foreach (Document doc in PintaCore.Workspace.OpenDocuments)
            {
                doc.Renamed -= HandleDocRenamed;
                doc.Renamed += HandleDocRenamed;

                store.AppendValues(CreateImagePreview(doc), doc.Filename, close_icon);
            }
        }
Ejemplo n.º 8
0
 void LoadI18nValues(string values)
 {
     i18nStore.Clear();
     if (values == null)
     {
         foreach (string s in i18n)
         {
             i18nStore.AppendValues(s, false);
         }
     }
     else
     {
         var arr = values.Split(',');
         foreach (string s in i18n)
         {
             i18nStore.AppendValues(s, arr.Contains(s));
         }
     }
 }
Ejemplo n.º 9
0
        void UpdateHistory()
        {
            scrolledLoading.Hide();
            scrolledLog.Show();
            logstore.Clear();
            var h = History;

            if (h == null)
            {
                return;
            }
            foreach (var rev in h)
            {
                if (MatchesFilter(rev))
                {
                    logstore.AppendValues(rev);
                }
            }
        }
Ejemplo n.º 10
0
        private void EntryTextChanges(object o, TextInsertedArgs args)
        {
            if (string.IsNullOrWhiteSpace(Text))
            {
                _completionListStore?.Clear();
                return;
            }

            if (StreetGuid != null)
            {
                HousesDataLoader.LoadHouses(Text, StreetGuid);
                return;
            }

            if (CityGuid != null)
            {
                HousesDataLoader.LoadHouses(Text, null, CityGuid);
            }
        }
Ejemplo n.º 11
0
        /// <summary>Populate the tree view.</summary>
        private void PopulateTreeView()
        {
            var types = new Type[table.Columns.Count];

            columns = new List <TreeViewColumn>();
            cells   = new List <CellRendererText>();

            // Clear all columns from tree.
            while (tree.Columns.Length > 0)
            {
                tree.RemoveColumn(tree.Columns[0]);
            }

            // initialise column headers
            for (int i = 0; i < table.Columns.Count; i++)
            {
                types[i] = typeof(string);
                var cell = new CellRendererText();
                cells.Add(cell);
                columns.Add(new TreeViewColumn {
                    Title = table.Columns[i].ColumnName, Resizable = true, Sizing = TreeViewColumnSizing.GrowOnly
                });
                columns[i].PackStart(cells[i], false);
                columns[i].AddAttribute(cells[i], "text", i);
                columns[i].AddNotification("width", OnColumnWidthChange);
                columns[i].SetCellDataFunc(cell, OnFormatColumn);
                tree.AppendColumn(columns[i]);
            }

            var store = new ListStore(types);

            tree.Model          = store;
            tree.Selection.Mode = SelectionMode.Multiple;
            tree.RubberBanding  = true;
            tree.CanFocus       = true;

            // Populate with rows.
            store.Clear();
            foreach (DataRow row in table.Rows)
            {
                store.AppendValues(row.ItemArray);
            }
        }
Ejemplo n.º 12
0
        void UserTasksChanged(object sender, TaskEventArgs e)
        {
            if (updating)
            {
                return;
            }

            if (view.IsRealized)
            {
                view.ScrollToPoint(0, 0);
            }

            store.Clear();
            foreach (TaskListEntry task in TaskService.UserTasks)
            {
                store.AppendValues(GettextCatalog.GetString(Enum.GetName(typeof(TaskPriority), task.Priority)), task.Completed, task.Description, task, GetColorByPriority(task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);
            }
            ValidateButtons();
        }
Ejemplo n.º 13
0
        internal void ShowStyles()
        {
            styleStore.Clear();
            bool     error;
            var      defaultStyle = LoadStyle(MonoDevelop.Ide.Editor.Highlighting.EditorTheme.DefaultThemeName, out error);
            TreeIter selectedIter = styleStore.AppendValues(GetMarkup(defaultStyle.Name, ""), defaultStyle);

            foreach (string styleName in SyntaxHighlightingService.Styles)
            {
                if (styleName == MonoDevelop.Ide.Editor.Highlighting.EditorTheme.DefaultThemeName)
                {
                    continue;
                }
                var    style = LoadStyle(styleName, out error);
                string name  = style.Name ?? "";
                if (string.IsNullOrEmpty(name))
                {
                    continue;
                }
                string description = "";
                // translate only build-in sheme names
                if (string.IsNullOrEmpty(style.FileName))
                {
                    try {
                        name = GettextCatalog.GetString(name);
                        if (!string.IsNullOrEmpty(description))
                        {
                            description = GettextCatalog.GetString(description);
                        }
                    } catch {
                    }
                }
                TreeIter iter = styleStore.AppendValues(GetMarkup(name, description), style, error);
                if (style.Name == DefaultSourceEditorOptions.Instance.EditorTheme)
                {
                    selectedIter = iter;
                }
            }
            if (styleTreeview.Selection != null)
            {
                styleTreeview.Selection.SelectIter(selectedIter);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Set up the form controls with the intial values from the model
        /// </summary>
        public void SetValues()
        {
            this.paramSet = StockList.MakeParamSet("");   // can use the param filename from component inits

            genoList.Clear();
            string[] genoNames = new string[genotypeInits.Length];
            for (int i = 0; i < genotypeInits.Length; i++)
            {
                genoNames[i] = genotypeInits[i].Name;
                genoList.AppendValues(genotypeInits[i].Name);
            }
            cbxGroupGenotype.Values = genoNames;        // animals tab

            GenotypeInitArgs args = new GenotypeInitArgs();

            args.Genotypes = genotypeInits;
            args.ParamSet  = this.paramSet;
            for (int idx = 0; idx < genotypeInits.Length; idx++)
            {
                args.index = idx;
                GetGenoParams.Invoke(null, args);   // gets params from the stock model

                if (this.genotypeSet != null)
                {
                    FGenotypeAnimals[idx] = this.genotypeSet.Animal;
                }
                else
                {
                    FGenotypeAnimals[idx] = GrazType.AnimalType.Sheep;
                }
            }
            FCurrGenotype = Math.Min(0, genotypeInits.Length - 1);
            FillCurrGenotype();

            FILLING = true;
            if (FCurrGenotype >= 0)
            {
                SelectedGenoIndex = FCurrGenotype;
            }
            FILLING = false;

            EnableButtons();
        }
Ejemplo n.º 15
0
        void MarketSummaries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            var coll = sender as ICollection <PriceTicker>;

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Replace:
                Debug.Assert(e.NewItems.Count == 1);
                Debug.Assert(e.NewStartingIndex == e.OldStartingIndex);
                //Debug.Print($"MarketSummaries: Replaced {e.NewItems.Count} item(s).");
                Gtk.Application.Invoke(delegate
                {
                    TreeIter iter;
                    store.GetIterFromString(out iter, e.OldStartingIndex.ToString());
                    store.SetValue(iter, 0, e.NewItems[0]);
                });
                break;

            case NotifyCollectionChangedAction.Remove:
                Debug.Assert(e.OldItems.Count == 1);
                //Debug.Print($"MarketSummaries: Removed {e.OldItems.Count} item(s).");
                Gtk.Application.Invoke(delegate
                {
                    TreeIter iter;
                    store.GetIterFromString(out iter, e.OldStartingIndex.ToString());
                    store.Remove(ref iter);
                });
                break;

            case NotifyCollectionChangedAction.Reset:
                Debug.Print($"MarketSummaries: Reset. {coll.Count} item(s).");
                Gtk.Application.Invoke(delegate
                {
                    store.Clear();
                    foreach (var item in coll)
                    {
                        store.AppendValues(item);
                    }
                    BuildMarkets();
                });
                break;
            }
        }
Ejemplo n.º 16
0
        protected void OnButtonEditReceiveMessagesClicked(object sender, EventArgs e)
        {
            DialogMsgInPrc dlMP = new DialogMsgInPrc();

            dlMP.LoadData(currentPrc.receiveMessages);
            ResponseType resp = (ResponseType)dlMP.Run();

            if (Gtk.ResponseType.Ok == resp)
            {
                lsRM.Clear();
                currentPrc.receiveMessages.Clear();
                foreach (var item in dlMP.lstSelectedMsgs)
                {
                    lsRM.AppendValues(item);
                    currentPrc.receiveMessages.Add(Group <Message> .GFindWithName(item));
                }
            }
            dlMP.Destroy();
        }
Ejemplo n.º 17
0
        private void networkCombo_Changed(object o, EventArgs args)
        {
            roomListStore.Clear();

            Network selectedNetwork = GetSelectedNetwork();

            if (selectedNetwork != null)
            {
                foreach (ChatRoom room in selectedNetwork.ChatRooms)
                {
                    ((ListStore)roomNameCombo.Model).AppendValues(room.Name, room);
                }
            }

            EnableDisableOkButton();

            roomNameCombo.Sensitive = (selectedNetwork != null);
            passwordCheck.Sensitive = (selectedNetwork != null);
        }
Ejemplo n.º 18
0
Archivo: Window.cs Proyecto: MrJoe/lat
        void ShowEntrySchema(SchemaParser sp)
        {
            try {
                objRequiredStore.Clear();
                objOptionalStore.Clear();

                objIDEntry.Text          = sp.ID;
                objDescriptionEntry.Text = sp.Description;

                string tmp = "";

                foreach (string a in sp.Names)
                {
                    tmp += String.Format("{0}\n", a);
                }

                objNameTextview.Buffer.Text = tmp;

                tmp = "";

                string[] superiors = sp.Superiors ?? new string[0];
                foreach (string b in superiors)
                {
                    tmp += String.Format("{0}\n", b);
                }

                objSuperiorTextview.Buffer.Text = tmp;

                string[] requireds = sp.Required ?? new string[0];
                foreach (string c in requireds)
                {
                    objRequiredStore.AppendValues(c);
                }

                string[] optionals = sp.Optional ?? new string[0];
                foreach (string d in optionals)
                {
                    objOptionalStore.AppendValues(d);
                }

                objObsoleteCheckbutton.Active = sp.Obsolete;
            } catch {}
        }
        public void LoadDevices(ApplicationDataModel dataModel)
        {
            this.DataModel = dataModel;

            int previousDeviceIndex = comboboxDevices.Active;

            ignoreComboboxChange = true;

            store.Clear();

            foreach (BlinkStickDeviceSettings entity in dataModel.Devices)
            {
                store.AppendValues(entity);
            }

            comboboxDevices.Model = store;

            ignoreComboboxChange = false;

            if (store.IterNChildren() >= 1)
            {
                if (previousDeviceIndex == -1)
                {
                    if (AutoSelectDevice)
                    {
                        comboboxDevices.Active = 0;
                    }
                }
                else
                {
                    while (store.IterNChildren() <= previousDeviceIndex)
                    {
                        previousDeviceIndex--;
                    }

                    comboboxDevices.Active = previousDeviceIndex;
                }
            }
            else
            {
                comboboxDevices.Active = -1;
            }
        }
Ejemplo n.º 20
0
        private void GetTables()
        {
            tableModel.Clear();
            tablesComboModel.Clear();
            SqliteConnection conn = (SqliteConnection)sqlLiteDal.GetConnect();
            SqliteDataReader dr   = null;

            try {
                //conn.Open();
                using (SqliteCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "SELECT name,sql FROM sqlite_master WHERE type='table' ORDER BY name;";
                    dr = cmd.ExecuteReader();
                }

                if (dr.HasRows)
                {
                    //int fieldcount = dr.FieldCount;
                    int cnt = -1;
                    while (dr.Read())
                    {
                        string name   = dr[0].ToString();
                        string schema = dr[1].ToString();
                        tablesComboModel.AppendValues(name, schema);
                        cnt++;
                    }
                    cbTable.Active = cnt;
                    countTables    = cnt;
                }
            } catch (Exception ex) {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error, null);
                ms.ShowDialog();
            } finally {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
                conn.Close();
                conn = null;;
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Populates the TreeView with data.
 /// </summary>
 /// <param name="simulations">List of rows. Each row represents a single simulation and is a tuple, made up of a string (simulation name), a list of strings (factor levels) and a boolean (whether the simulation is currently enabled).</param>
 public void Populate(List <Tuple <string, List <string>, bool> > simulations)
 {
     Application.Invoke(delegate
     {
         store.Clear();
         foreach (Tuple <string, List <string>, bool> sim in simulations)
         {
             // First cell in the row needs to hold the simulation name
             List <string> data = new List <string> {
                 sim.Item1
             };
             foreach (string level in sim.Item2)
             {
                 data.Add(level);
             }
             data.Add(sim.Item3.ToString());
             store.AppendValues(data.ToArray());
         }
     });
 }
Ejemplo n.º 22
0
        void UserTasksChanged(object sender, TaskEventArgs e)
        {
            if (updating)
            {
                return;
            }

            if (view.IsRealized)
            {
                view.ScrollToPoint(0, 0);
            }

            store.Clear();
            foreach (TaskListEntry task in TaskService.UserTasks)
            {
                var text = priorities [GetEnumIndex(task.Priority)];
                store.AppendValues(text, task.Completed, task.Description, task, GetColorByPriority(task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);
            }
            ValidateButtons();
        }
        void FillBuilders()
        {
            builders.Clear();
            foreach (PackageBuilder builder in DeployService.GetPackageBuilders())
            {
                builders.Add(builder);
            }

            store.Clear();
            foreach (PackageBuilder builder in builders)
            {
                Gdk.Pixbuf pix = ImageService.GetPixbuf(builder.Icon, Gtk.IconSize.LargeToolbar);
                store.AppendValues(pix, builder.Description, builder);
            }

            if (builders.Count > 0)
            {
                SelectBuilder(builders[0]);
            }
        }
        void FillCategs()
        {
            storeCategs.Clear();
            XmlElement cats = desktopInfo.DocumentElement ["Categories"];

            foreach (string cat in entry.Categories)
            {
                XmlNode node = cats.SelectSingleNode("Category[@name='" + cat + "']/@_label");
                string  catName;
                if (node != null)
                {
                    catName = node.InnerText;
                }
                else
                {
                    catName = cat;
                }
                storeCategs.AppendValues(Mono.Unix.Catalog.GetString(catName), cat);
            }
        }
Ejemplo n.º 25
0
        private void UpdateTable()
        {
            try
            {
                table.Clear();
                if (fst.HasReferenceImage)
                {
                    table.AppendValues(System.IO.Path.GetFileName(RefImgChooser.Filename), "Reference Image", 0, 0, 0);
                }

                if (fst.FilterImages.Count > 0)
                {
                    for (int i = 0; i < fst.FilterImages.Count; i++)
                    {
                        table.AppendValues(System.IO.Path.GetFileName(FilterImgChooser.Filename), "Filter Image", fst.WBJumps[i], fst.TintJumps[i], fst.EVJumps[i]);
                    }
                }
            }
            catch (Exception ex) { ErrorReport.ReportError("Update Table (Create Filterset)", ex); }
        }
        void UpdateHistory()
        {
            scrolledLoading.Hide();
            scrolledLog.Show();
            logstore.Clear();
            var h = History;

            if (h == null)
            {
                return;
            }
            foreach (var rev in h)
            {
                if (MatchesFilter(rev))
                {
                    logstore.AppendValues(rev, string.Empty);
                }
            }
            SetLogSearchFilter(logstore, currentFilter);
        }
Ejemplo n.º 27
0
        private void EntryChanged(object obj, EventArgs args)
        {
            lock (this) {
                lock (found) {
                    lock (todoTypes) {
                        bool startThread = todoTypes.Count == 0;

                        // clear current results
                        typesStore.Clear();
                        membersStore.Clear();
                        todoTypes.Clear();
                        found.Clear();
                        if (idle != 0)
                        {
                            GLib.Source.Remove(idle);
                            idle = 0;
                        }
                        foundTypes = foundMembers = 0;
                        browser.AppBar.SetStatus("");

                        // prepare new work
                        text = entry.Text;
                        if (text.Length > 0)
                        {
                            foreach (Type type in browser.types.Values)
                            {
                                todoTypes.Enqueue(type);
                            }

                            if (startThread)
                            {
                                ThreadStart start = new ThreadStart(WorkThread);

                                findThread = new System.Threading.Thread(start);
                                findThread.Start();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 28
0
        private void LoadConflicts()
        {
            if (paths.Count == 0)
            {
                return;
            }
            var conflicts = repository.GetConflicts(paths);

            listStore.Clear();
            foreach (var conflict in conflicts)
            {
                var row = this.listStore.AddRow();
                this.listStore.SetValue(row, itemField, conflict);
                this.listStore.SetValue(row, typeField, conflict.ConflictType.ToString());
                var path = ((FilePath)conflict.TargetLocalItem).ToRelative(paths[0]);
                this.listStore.SetValue(row, nameField, path);
                this.listStore.SetValue(row, versionBaseField, conflict.BaseVersion);
                this.listStore.SetValue(row, versionTheirField, conflict.TheirVersion);
                this.listStore.SetValue(row, versionYourField, conflict.YourVersion);
            }
        }
Ejemplo n.º 29
0
        public void UpdateFileList(bool copy = false)
        {
            if (TableName == "" || AttachToTable == "" || ItemId < 0)
            {
                return;
            }
            logger.Info("Загружаем список файлов для {0}<{1}>", AttachToTable, ItemId);
            string filefield = copy ? ", file " : "";
            string sql       = String.Format("SELECT id, name, size{1} FROM {0} WHERE item_group = @item_group AND item_id = @item_id",
                                             TableName, filefield);

            try {
                MySqlCommand cmd = new MySqlCommand(sql, (MySqlConnection)QSMain.ConnectionDB);
                cmd.Parameters.AddWithValue("@item_group", AttachToTable);
                cmd.Parameters.AddWithValue("@item_id", ItemId);
                FilesStore.Clear();
                byte[] file = null;
                using (MySqlDataReader rdr = cmd.ExecuteReader()) {
                    while (rdr.Read())
                    {
                        if (copy)
                        {
                            file = new byte[rdr.GetInt64("size")];
                            rdr.GetBytes(rdr.GetOrdinal("file"), 0, file, 0, rdr.GetInt32("size"));
                        }
                        FilesStore.AppendValues(copy ? -1 : rdr.GetInt32("id"),
                                                rdr.GetString("name"),
                                                rdr.GetInt64("size"),
                                                FileIconWorks.GetPixbufForFile(rdr.GetString("name")),
                                                copy ? file : null
                                                );
                    }
                }
                logger.Info("Ок");
            } catch (Exception ex) {
                string mes = "Ошибка списка файлов!";
                logger.Error(ex, mes);
                throw new ApplicationException(mes, ex);
            }
        }
Ejemplo n.º 30
0
        public void UpdateGameTable()
        {
            if (_updatingGameTable || _gameLoaded)
            {
                return;
            }

            _updatingGameTable = true;

            _tableStore.Clear();

            Thread applicationLibraryThread = new Thread(() =>
            {
                _applicationLibrary.LoadApplications(ConfigurationState.Instance.Ui.GameDirs, ConfigurationState.Instance.System.Language);

                _updatingGameTable = false;
            });

            applicationLibraryThread.Name         = "GUI.ApplicationLibraryThread";
            applicationLibraryThread.IsBackground = true;
            applicationLibraryThread.Start();
        }