Stat.ItemToggled C# (CSharp) Method

ItemToggled() public method

public ItemToggled ( object o, ToggledArgs args ) : void
o object
args ToggledArgs
return void
    void ItemToggled(object o, ToggledArgs args)
    {
        LogB.Information("Fake button will be pressed");
        fakeButtonRowCheckedUnchecked.Click();

        int column = 0;

        TreeIter iter;
        if (store.GetIter (out iter, new TreePath(args.Path)))
        {
            bool val = (bool) store.GetValue (iter, column);
            //LogB.Information ("toggled {0} with value {1}", args.Path, !val);

            //if this row is not AVG or SD
            string avgOrSD = (string) store.GetValue (iter, 1);
            if(avgOrSD != Catalog.GetString("AVG") && avgOrSD != Catalog.GetString("SD"))
            {
                //change the checkbox value
                store.SetValue (iter, column, !val);
                //add or delete from ArrayList markedRows
                //if (val) means was true, and now has changed to false. Has been deactivated
                if(val) {
                    deleteRowFromMarkedRows(args.Path);
                } else {
                    addRowToMarkedRows(args.Path);
                }
                CreateOrUpdateAVGAndSD();
            }

            if (isThereAnyRowSelected(store)) {
                fakeButtonRowsSelected.Click();
            } else {
                fakeButtonNoRowsSelected.Click();
            }
        } else {
            //if we cannot access the treeview, also don't allow to graph or report
            fakeButtonNoRowsSelected.Click();
        }
    }