[Gtk-sharp-list] GTK#3 (was: Re: GTK# Window Display Issue Outside of Main.cs)
Andres G. Aragoneses
knocte at gmail.com
Wed Nov 7 01:59:11 UTC 2012
If you're demanding binaries for Linux, you should ask in your
distribution forums/mailinglists.
If other OS, we're asking for community contributions to bring those for
the final 3.0 release.
PS: Next time try to not hijack threads ;)
On 07/11/12 01:37, Gustavo Rubio wrote:
> Speaking of, are there any binaries of GTK# 2.99 available?
>
> On Tue, Nov 6, 2012 at 6:53 PM, Andres G. Aragoneses <knocte at gmail.com
> <mailto:knocte at gmail.com>> wrote:
>
> And a good tool to fix what just Joe brought up is:
>
> https://github.com/slluis/gui-__thread-check
> <https://github.com/slluis/gui-thread-check>
>
> This tool will, furthermore, be bundled by default in the next
> 2.99.1 release (so one more incentive to upgrade ).
>
>
> On 06/11/12 22:37, Joe Dluzen wrote:
>
> Though I haven't run your code, my first guess would be threading
> issues. As with practically all GUI toolkits, components are not
> only
> not threadsafe, but code doing anything with the components must be
> invoked on the same thread, please see here:
> http://www.mono-project.com/__Responsive_Applications
> <http://www.mono-project.com/Responsive_Applications>
>
> In the code you have not posted, is anything started on new
> threads, or
> on the threadpool? If so, you'd need to Invoke() any and all
> update code
> to the GUI thread. All speculation right now, sorry.
>
> Joe
>
>
> On Tue, Nov 6, 2012 at 2:36 PM, Johnnie Odom
> <jodom at escambia.k12.fl.us <mailto:jodom at escambia.k12.fl.us>
> <mailto:jodom at escambia.k12.fl.__us
> <mailto:jodom at escambia.k12.fl.us>>> wrote:
>
> Hello Everyone,
>
>
> This is my first day on the mailing list, and as it is I have a
> question regarding some odd behavior I am encountering.
>
>
> I am writing an application on OS X 10.8 using C#, Mono
> 2.10.9 and
> MonoDevelop 3.0.4 (including the Designer views) that makes
> some
> simple changes to LDAP. As part of it, I decided to get
> fancy with
> GTK#. All is going well, except for one behavior.
>
>
> I have created a window class to display a progress bar and
> stop
> button. I have further created a function in this class to
> update
> the progress bar with a fraction and text message. In my
> code, I
> create a new instance of this window class when real work is
> happening in another class, and then populate it after
> every ten
> iterations of a foreach loop.
>
>
> My problem is that when the window is created FROM THE
> CLASS DOING
> REAL WORK, it displays neither the progress bar widget, nor the
> button. It displays only the window title and then white space
> below. Only this window displays this behavior -- several other
> windows that I create over the course of the application
> all display
> appropriately.
>
>
> If I instead create the progress bar window in Main.cs and call
> Show(), it will display just fine. I can even call the
> function to
> set its status from Main.cs and it will display correctly.
>
>
> I have tried creating the window in Main.cs and passing it
> to the
> class that does the real work later. I have tried creating
> it in
> other classes besides the one that does the work. In all
> cases the
> behavior is the same -- if the window is created and used
> solely in
> Main.cs it will display fine, but if it it ever invoked or
> created
> from anywhere else (whether or not it is created in another
> class or
> in Main.cs) it will display incorrectly.
>
>
> I have taken to using the debugger and break points to
> isolate the
> behavior. If I set a breakpoint immediately after the window is
> created, it is still blank -- that is, I do not think it is
> a case
> that the window is just not keeping pace with any updates I am
> sending. I have also compared the various values of the window
> objects and attributes when it is displayed (created and
> used solely
> in Main.cs) and when it is not (displayed in any other
> class) and
> they seem to be identical.
>
>
> So, I am at a loss, and I would appreciate any advice you
> might give.
>
>
> I can send any code you think would prove useful, but for
> now I am
> sending you the class where I am trying to call the window,
> and the
> contents of the window's code-behind.
>
>
> Thank you for any guidance you can give.
>
>
> Johnnie Odom
>
> Network Services
>
> School District of Escambia County
>
>
> ****************
>
>
> The function from the calling class:
>
> public string radiazerMain(string radiazerGroup, string
> radiazerProfile){
>
> Progression MarathonBar = new Progression();
>
> MarathonBar.Show();
>
> string monologger = "";
>
> string lastLine = "Radiazer completed current run." +
> Environment.NewLine;
>
> Array usersToModify = getGroupMembers(radiazerGroup)__;
>
> string[] radiusAttribs = new
>
> string[]{"dialupAccess","__radiusArapFeatures","__radiusArapSecurity","__radiusArapZoneAccess","__radiusAuthType","__radiusCallbackId","__radiusCallbackNumber","__radiusCalledStationId","__radiusCallingStationId","__radiusCheckItem","radiusClass"__,"radiusClientIPAddress","__radiusExpiration","__radiusFilterId","__radiusFramedAppleTalkLink","__radiusFramedAppleTalkNetwork",__"radiusFramedAppleTalkZone","__radiusFramedCompression","__radiusFramedIPAddress","__radiusFramedIPNetmask","__radiusFramedIPXNetwork","__radiusFramedMTU","__radiusFramedProtocol","__radiusFramedRoute","__radiusFramedRouting","__radiusGroupName","radiusHint",__"radiusHuntgroupName","__radiusIdleTimeout","__radiusLoginIPHost","__radiusLoginLATGroup","__radiusLoginLATNode","__radiusLoginLATPort","__radiusLoginLATService","__radiusLoginService","__radiusLoginTCPPort","__radiusLoginTime","__radiusPasswordRetry","__radiusPortLimit","__radiusProfileDn","__radiusPrompt","__radiusProxyToRealm","__radiusRealm","_
_radiusReplicateToRealm","__radiusReplyItem","__radiusServiceType","__radiusSessionTimeout"
>
> ,
> "radiusSimultaneousUse","__radiusStripUserName","__radiusTerminationAction","__radiusTunnelAssignmentId","__radiusTunnelClientEndpoint","__radiusTunnelMediumType","__radiusTunnelPassword","__radiusTunnelPreference","__radiusTunnelPrivateGroupId","__radiusTunnelServerEndpoint","__radiusTunnelType","__radiusUserCategory","__radiusVSA"};
>
>
>
> LdapAttributeSet profileTemplate =
> LdapAttributeSetFiltered(__radiazerProfile, radiusAttribs);
>
> profileTemplate.Add(new LdapAttribute("__radiusProfileDn",
> radiazerProfile));
>
>
> int totalUsersCount = usersToModify.Length;
>
> int currentUserCount = 0;
>
> int errorCount = 0;
>
> MarathonBar.Show();
>
>
> foreach(string userToModify in usersToModify){
>
> currentUserCount++;
>
> try{
>
> monologger = monologger + radiazeModifyUser(__userToModify,
> profileTemplate);
>
> }
>
> catch(LdapException LdapFailure){
>
> monologger = monologger + "User " + userToModify + "
> failed. Error
> is " + LdapFailure.ToString() + Environment.NewLine;
>
> errorCount++;
>
> }
>
> if(((currentUserCount % 10) == 0) || ((totalUsersCount -
> currentUserCount) < 10)){
>
> MarathonBar.setProgress(((__double)currentUserCount /
> totalUsersCount), totalUsersCount , currentUserCount,
> errorCount,
> userToModify);
>
> }
>
> if(MarathonBar.cancelFromUser)__{
>
> lastLine = "Radiazer cancelled by user." + Environment.NewLine;
>
> break;
>
> }
>
> }
>
>
> MarathonBar.Destroy();
>
> monologger = monologger + lastLine;
>
> return monologger;
>
> }
>
>
> *************
>
>
> The Code-Behind:
>
>
> using System;
>
>
> namespace Radiazer2
>
> {
>
> public partial class Progression : Gtk.Window
>
> {
>
>
> public bool cancelFromUser = false;
>
>
> public Progression () :
>
> base(Gtk.WindowType.Toplevel)
>
> {
>
> this.Build ();
>
> }
>
>
> public void setProgress(double fractionOfProgress, int
> totalUnits,
> int finishedUnits, int errorUnits, string finishedUser){
>
> this.progressIndicator.__Fraction = fractionOfProgress;
>
> this.progressIndicator.Text = "Completed " + finishedUnits
> + " of "
> + totalUnits + " with " + errorUnits + " errors. Current
> user is " +
> finishedUser + ".";
>
> }
>
>
> protected void OnStopUserClicked (object sender, EventArgs e)
>
> {
>
> cancelFromUser = true;
>
> }
>
More information about the Gtk-sharp-list
mailing list