Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

MarioMARTIN

@MarioMARTIN
About
Posts
21
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to implement a Slot-Machine
    M MarioMARTIN

    Hi! I'm planning to program some sort of electronic gaming machine / slot-machine (like: 5 columns with "Reels", each "Reel" shows some symbols, if you have 5 symbols in a row you hit the Jackpot). Although I think I'm already familiar with WPF's basics (how to create controls and edit their style), I have no clue how to solve this task with WPF. Are there any suggestions how I should program those "Reels"? Should I play videos or could it be solved by "animating" some icons? I have really no clue. Thanks, Mario M.

    Cheers, Mario M.

    Dear CodeProject member: Please don't forget to show me how clever you are by rating also this message as "crap/spam/trash" instead of writing a meaningful response!

    C# csharp wpf tutorial question

  • Buzzycode.com
    M MarioMARTIN

    Pretty cool: here and here. Maybe it's a gate to a weird parallel universe? Who knows? ;-) BTW: I like the cat in the top left corner... I think I'm gonna switch to Buzzycode ;-)

    Cheers, Mario M.

    Dear CodeProject member: Please don't forget to show me how clever you are by rating also this message as "crap/spam/trash" instead of writing a meaningful response!

    Site Bugs / Suggestions database com architecture tutorial

  • Voting System
    M MarioMARTIN

    F.Y.I: Chris wrote: --------------------------------------------------------- Hi Mario, We've noodled over this one and all agree that asking for comments on low votes will mean lots of "asdf" comments. What we'll do instead is display a voting histogram - it will show which votes are spurious cheers, Chris Maunder ---------------------------------------------------------

    Cheers, Mario M.

    Dear CodeProject member: Please don't forget to show me how clever you are by rating also this message as "crap/spam/trash" instead of writing a meaningful response!

    Site Bugs / Suggestions question code-review

  • Voting System
    M MarioMARTIN

    "If an article has merit, then others will vote higher when they read it." Will they? Since friday my article had 1,190 viewers but I only received three votes. Actually only two people decided to vote after I rated my own article on saturday. Of course now you can say: maybe your article is crap. Maybe it is, but I'll never know why.

    Cheers, Mario M.

    Dear CodeProject member: Please don't forget to show me how clever you are by rating also this message as "crap/spam/trash" instead of writing a meaningful response!

    Site Bugs / Suggestions question code-review

  • Voting System
    M MarioMARTIN

    Hi Chris or who ever is in charge! I'm sorry for contacting you this way but I have a complaint: How does this "article voting system" work? And what is even more important: What is it good for? I mean: we don't get paid for writing articles and that's OK but I don't see why an author should get discredited by frustrated teens that give bad votes just for fun. I'd suggest that negative votes must contain a reasonable explanation that states why the according article is "crap". Otherwise the author has no idea how he/she should improve his/her article and this leads to frustration! And why are those votings anonymously? If someone thinks that my article is "poor" I'd like to know why! Maybe you should reconsider that voting system! Cheers, Mario M.

    Dear CodeProject member: Please don't forget to show me how clever you are by rating also this message as "crap/spam/trash" instead of writing a meaningful response!

    Site Bugs / Suggestions question code-review

  • Application terminates when window gets closed
    M MarioMARTIN

    Problem solved:

    [STAThread]
    static void Main()
    {
    Application app = new Application();
    app.ShutdownMode = ShutdownMode.OnExplicitShutdown; //that's the trick
    MyApp win = new MyApp();
    app.Run();
    }

    class MyApp
    {
      public MyApp()
      {
        m\_Win = new Window();
        m\_Win.ShowDialog();
      }
    
      Window m\_Win;
    }
    

    }

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    How about looking at the two DIFFERENT code samples I posted? In the first snipped I create an App that has a window as member (only one window). When the window gets closed also the app terminates. And in the second sample I create a hidden window that has an additional window as member (two windows). I don't say: m_window.hidden! I hide the parent! But I think creating a hidden window just to make sure that the class itself survives when one of its members gets closed is quite ugly. So, please have a look at the code first, before you start getting wise! ;-) Mario M.

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    Hi! "Which, is what Luc pointed out, very well explaint, here!" And what I already posted here Ciao Mario M.

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    Forget it, I'll take the "derive from Window" approach Thanks, Mario M.

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    "as an alternative you can call Application.Run(); without arguments;" yeah thanks, but I think taht is what I showed already in my first posting. Maybe I should try it verbally: 1.) I want an application that instantiates a class 2.) This class should open a window 3.) When the window gets closed the class should stay 'alive' (and therefore also the application must not get terminated) Mario M.

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    So what's your point? In the first case I derived it from 'Application' and in the second I derived it from 'Window'. But I don't want to derive it from 'Window' because it is no window.

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    It Works when I derive MyApp from System.Windows.Window but it looks quite ugly:

    public class MyApp : Window

    {

    public MyApp()

    {

      this.Visibility = Visibility.Hidden;
    
      m\_Window = new Window();
    

    }

    Window m_Window;

    }

    class Program

    {

    [STAThread]

    static void Main()

    {

    Application app = new Application();
    
    MyApp win = new MyApp();
    
    app.Run();
    

    }

    }

    C# question

  • Application terminates when window gets closed
    M MarioMARTIN

    Hi! I have something like this:

    public class MyApp: System.Windows.Application
    {
    public MyApp()
    {

    m\_Window = new Window();
    
    //loads of other stuff
    

    }

    Window m_Window;
    }

    and it gets instantiated from:

    class Program
    {
    [STAThread]
    static void Main()
    {
    MyApp app = new MyApp();
    app.Run();
    }
    }

    Every time someone says m_Window.Close() the whole application gets terminated ( = also 'app' gets terminated). But that is not what I want, I want only to close m_Window ( = 'app' should keep running). So, where did I go wrong? Thanks, Mario M.

    C# question

  • Mutex and user account
    M MarioMARTIN

    Problem solved: "[...] The \Sessions\1\... is created by Terminal service session (or Fast User Switching which uses terminal services). To make a Mutex global across all sessions prefix the name with 'Global\' [...]" MMartin

    C# csharp wpf question learning

  • Mutex and user account
    M MarioMARTIN

    Hi, we found out that the Windows Services created a Mutex named: \BaseNamedObjects\Map_ConfigFile_Mutex while the WPF-Application (Admin = Icon in System Tray with hidden Window) creates: \Sessions\1\BaseNamedObjects\Map_ConfigFile_Mutex Any idea how I can solve this issue? Thanks, MMartin

    C# csharp wpf question learning

  • Mutex and user account
    M MarioMARTIN

    Thanks, but "I'm locking this resource with a system-wide Mutex" (=named Mutex) MMartin

    C# csharp wpf question learning

  • Mutex and user account
    M MarioMARTIN

    Hi all! I have Windows Services and a WPF application that should share a common resource (config file). To make sure that no application is reading while another is writing I'm locking this resource with a system-wide Mutex. It doesn't work. The Mutex doesn't seem to be unique. Can it be that a Mutex is not unique if a Windows Service (running under the System account) and an WPF application (running under the user account) try to create a Mutex? thanks, MMartin

    C# csharp wpf question learning

  • configuration file
    M MarioMARTIN

    I rephrased my question and asked it again in the C# discussion board, since this entry "went out of scope"... http://www.codeproject.com/script/comments/forums.asp?msg=2189444&forumid=1649&mode=all&userid=4249752#xx2189444xx

    C# csharp wpf wcf xml question

  • configuration file
    M MarioMARTIN

    Aha, it seems that the Mutex is not unique: //create a mutex to assure that only one process at a time //accesses the config file bool isNew = false; m_Mutex = new Mutex( false, "Map_ConfigFile_Mutex", out isNew ); if ( isNew ) { Core.Tracer.Info( "Mutex is new in System" ); } else { Core.Tracer.Info( "Mutex is NOT new in System" ); } Application 1 (Windows Service) log: 20.08.2007 08:09:40.672; Agent:; Mutex is new in System Application 2 (WPF application) log: 20.08.2007 08:09:33.775; Admin:; Mutex is new in System I ensured that it is not a life-time problem. The Mutex object exists as long as the application (which created the Mutex) exists. So: How can a Mutex be created by two different processes. Does it make a difference that one application is a Windows Service? I noticed that, if Application 1 (Windows Service) creates the Mutex, all other Windows Services will say: 20.08.2007 08:09:41.712; Coordinator:; Mutex is NOT new in System very confusing... MMartin

    C# csharp wpf wcf xml question

  • configuration file
    M MarioMARTIN

    Hi Christian, thanks for your reply! "The issue you have is that only one application can have the file open, at a time." That's what I thought, too, and therefore I added a Mutex. Loading the config file: Core.Tracer.Info( "LoadConfigFile: Waiting for Mutex: " + i.ToString() ); m_Mutex.WaitOne(); Core.Tracer.Info( "LoadConfigFile: Locking Mutex: " + i.ToString() ); m_Document.Load( ConfigFileName ); m_Mutex.ReleaseMutex(); Core.Tracer.Info( "LoadConfigFile: Releasing Mutex: " + i.ToString() ); Writing the config file: Core.Tracer.Info( "SaveConfigFile: Waiting for Mutex: " + i.ToString() ); m_Mutex.WaitOne(); Core.Tracer.Info( "SaveConfigFile: Locking Mutex: " + i.ToString() ); if(m_Watcher != null) m_Watcher.EnableRaisingEvents = false; //disable FileSystemWatcher m_Document.Save( ConfigFileName ); if ( m_Watcher != null ) m_Watcher.EnableRaisingEvents = true; m_Mutex.ReleaseMutex(); Core.Tracer.Info( "SaveConfigFile: Releasing Mutex: " + i.ToString() ); But the Mutex is not working. In my log files I see something like this: Application 1 Log: 20.08.2007 07:43:20.730; Agent:; LoadConfigFile: Waiting for Mutex: 1 20.08.2007 07:43:20.730; Agent:; LoadConfigFile: Locking Mutex: 1 20.08.2007 07:43:20.733; Agent:; something happend in LoadConfigFile: The process cannot access the file 'C:\Map\Map.config' because it is being used by another process. Application 2 Log: 20.08.2007 07:43:20.724; Admin:; SaveConfigFile: Waiting for Mutex: 1 20.08.2007 07:43:20.726; Admin:; SaveConfigFile: Locking Mutex: 1 20.08.2007 07:43:20.752; Admin:; SaveConfigFile: Releasing Mutex: 1 I'm losing my mind? ;-) How can Application 1 lock the Mutex at 07:43:20.730 when it is already locked by application 2 at 07:43:20.726? Could it be that Mutex doesn't work in Windows Services? Thanks, MMartin

    C# csharp wpf wcf xml question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups