MainWindow
Inheritance: System.Windows.Window, System.Windows.Markup.IComponentConnector
        private void btnEnter_Click(object sender, RoutedEventArgs e)
        {            
            mTransit.NhanVien = Data.BONhanVien.Login(txtUserID.Text.Trim(), Utilities.SecurityKaraoke.GetMd5Hash(txtPassword.Text.Trim(), mTransit.HashMD5), mTransit);
            if (mTransit.NhanVien == null)
            {
                if (mTransit.Admin.TenDangNhap == txtUserID.Text.Trim() && mTransit.Admin.MatKhau == Utilities.SecurityKaraoke.GetMd5Hash(txtPassword.Text.Trim(), mTransit.HashMD5))
                {
                    mTransit.NhanVien = new Data.NHANVIEN();
                    mTransit.NhanVien.LoaiNhanVienID = mTransit.Admin.LoaiNhanVienID;
                    mTransit.NhanVien.TenNhanVien = mTransit.Admin.TenNhanVien;
                    mTransit.NhanVien.NhanVienID = 0;
                }
                else
                {
                    lbStatus.Text = "Tên đăng nhập hoặc mật khẩu không đúng";
                }
            }
            else
            {
                BONhanVien.ThemLichSuDangNhap(mTransit.NhanVien.NhanVienID);
                mTransit.LayDanhSachQuyen();
            }
            if (mTransit.NhanVien != null)
            {
                MainWindow win = new MainWindow(mTransit);
                this.Hide();
                win.ShowDialog();
            }

        }
Example #2
0
 //  En overloaded konstruktor som först tar två parametrar sedan anropar default konstruktorn som bygger formen. Tar ett objekt av klassen MainWindow för att kunna använda dess metoder.
 public saveWindow(string url, string whichButton, MainWindow main)
     : this()
 {
     button = whichButton;
     mainForm = main;
     tbUrl.Text = url;
     mainForm.fillCategory(cbCategories);
 }
        private SocketHandler _socket = new SocketHandler();	// Tempoary socket, to allow connections

        public ConnectWindow(MainWindow main)
        {
            InitializeComponent();

            _main = main;		// Letting the ConnectWindow know MainWindow

            // Setting Default Values (For Lazyness)
            this.inputAddress.Text = "10.140.83.99";
            this.inputPort.Text = "20001";
        }
Example #4
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.Main = ((GUI.MainWindow)(target));
         return;
     }
     this._contentLoaded = true;
 }
        public Configurator(string configsName, MainWindow window)
        {
            var document = XDocument.Load(configsName);

            var eventBus = new EventBus();

            InitLogs(window);
            InitConnector(document.Descendants("Connection").Single());

            var factory = GetFactory(document.Descendants("Types").Single());
            var tradeParams = GetParams(document.Descendants("TradeParams").Single());

            var currentDayCandles = Connector.GetCurrentDayCandles();
            var advisor = new TradeAdvisor(currentDayCandles);	//TODO больше истории

            RobotContext = new RobotContext(tradeParams, factory, advisor, currentDayCandles);
            InitTradeController(document.Descendants("TradeController").Single(), eventBus,
                LogManager.Configuration.Variables["WorkingDirectory"]);
        }
Example #6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Main = ((GUI.MainWindow)(target));
                return;

            case 2:
                this.Button_EEPREAD = ((System.Windows.Controls.Button)(target));

            #line 10 "..\..\MainWindow.xaml"
                this.Button_EEPREAD.Click += new System.Windows.RoutedEventHandler(this.Button_EEPREAD_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.Button_EEPWRITE = ((System.Windows.Controls.Button)(target));

            #line 11 "..\..\MainWindow.xaml"
                this.Button_EEPWRITE.Click += new System.Windows.RoutedEventHandler(this.Button_EEPWRITE_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.Button_DebugSend = ((System.Windows.Controls.Button)(target));

            #line 12 "..\..\MainWindow.xaml"
                this.Button_DebugSend.Click += new System.Windows.RoutedEventHandler(this.Button_DebugSend_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #7
0
        private static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                XmlConfigurator.Configure(new FileInfo("logconfig.xml"));

                Options.Options.SetSettings();
                EfsSystem.Instance.DictionaryChangesOnFileSystem += HandleInstanceDictionaryChangesOnFileSystem;

                MainWindow window = new MainWindow();
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

                {
                    // TRICKY SECTION
                    // This thread is mandatory otherwise WCF does not create a new thread to handle the service requests.
                    // Since the call to Cycle is blocking, creating such threads is mandatory
                    Thread thread = ThreadUtil.CreateThread("EFS Service", HostEfsService);
                    thread.Start();
                }

                // Opens the Dictionary files and check them
                bool shouldPlace = true;
                foreach (string fileName in args)
                {
                    const bool allowErrors = false;
                    OpenFileOperation openFileOperation = new OpenFileOperation(fileName, EfsSystem.Instance, allowErrors, true);
                    openFileOperation.ExecuteUsingProgressDialog("Opening file", false);
                    window.SetupWindows(openFileOperation.Dictionary, shouldPlace);
                    shouldPlace = false;
                }

                CheckModelOperation checkModel = new CheckModelOperation();
                checkModel.ExecuteUsingProgressDialog("Checking model");

                Application.Run(window);
                CloseEfsService();
            }
            finally
            {
                Util.UnlockAllFiles();
            }

            EfsSystem.Instance.Stop();
            SynchronizerList.Stop();
        }
Example #8
0
        private void AddSwaggerCommand(object sender, EventArgs e)
        {
            var project = VsHelpers.GetActiveProject(_dte);
            //todo: figure out if we doing CS or TS based on project type - if possible
            //todo: if we on a folder node, path should be folder
            var uiOptions = new UIOptions
            {
                Overwrite = true
            };

            uiOptions.Target = Path.Combine(Path.GetDirectoryName(project.FullName), "api.cs");
            var window = new MainWindow();
            window.SetUI(uiOptions);
            window.ShowDialog();
        }
Example #9
0
 public addCategoryForm(MainWindow mainWindow)
     : this()
 {
     mainForm = mainWindow;
 }
Example #10
0
 // Konstruktor kallas ifrån MainWindows konstruktor, så körs direkt när exe filen körs.
 public UpdateSavedFeeds(MainWindow main)
 {
     mainForm = main;
     initialize();
 }
        public static void Run()
        {
            StreamWriter writer = new StreamWriter(_stream);
            writer.AutoFlush = true;

            _output = "none";
            writer.WriteLine("/users");

            while (_active)
            {

                String text = _output;

                if (_auction._socket.Connection.Connected)
                {
                    if (text != "none")
                    {
                        if (Handler.regex_match(@"^([\/]{1})clear", text))
                        {
                            App.Current.Dispatcher.Invoke(new ClearChat(_auction.ClearChat));
                        }
                        else
                        {
                            writer.WriteLine(text);
                        }
                        _output = "none";
                    }
                }
                else
                {
                    _active = false;
                }

            }

            _auction._socket.Disconnect();	// Disconnecting && Closing streams, sockets etc.

            App.Current.Dispatcher.Invoke(new Notifier(_auction.ShowMessage), "You have been disconnected from the server!");	// Lets the user know they've been disconnected!
            App.Current.Dispatcher.Invoke(new Deactivate(_auction.Deactivater));

            // Resets Values
            _stream = null;
            _auction = null;
            _active = true;

        }
Example #12
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Battle = ((GUI.MainWindow)(target));
                return;

            case 2:
                this.TbMyShip = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.TbEnemyhip = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.ButFix = ((System.Windows.Controls.Button)(target));

            #line 63 "..\..\MainWindow.xaml"
                this.ButFix.Click += new System.Windows.RoutedEventHandler(this.ButFix_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.BtUpdate = ((System.Windows.Controls.Button)(target));

            #line 64 "..\..\MainWindow.xaml"
                this.BtUpdate.Click += new System.Windows.RoutedEventHandler(this.BtUpdate_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.ProgressYourLife = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 7:
                this.ButAttack = ((System.Windows.Controls.Button)(target));

            #line 74 "..\..\MainWindow.xaml"
                this.ButAttack.Click += new System.Windows.RoutedEventHandler(this.ButAttack_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.ChangeEnemy = ((System.Windows.Controls.Button)(target));

            #line 75 "..\..\MainWindow.xaml"
                this.ChangeEnemy.Click += new System.Windows.RoutedEventHandler(this.ChangeEnemy_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.ProgressEnemyLife = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 10:
                this.ImageMyShip = ((System.Windows.Controls.Image)(target));
                return;

            case 11:
                this.ImageEnemyShip = ((System.Windows.Controls.Image)(target));
                return;

            case 12:
                this.BtSave = ((System.Windows.Controls.Button)(target));

            #line 100 "..\..\MainWindow.xaml"
                this.BtSave.Click += new System.Windows.RoutedEventHandler(this.BtSave_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.BtOpen = ((System.Windows.Controls.Button)(target));

            #line 101 "..\..\MainWindow.xaml"
                this.BtOpen.Click += new System.Windows.RoutedEventHandler(this.BtOpen_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.ImgArmor = ((System.Windows.Controls.Image)(target));
                return;

            case 15:
                this.ImgWeapon = ((System.Windows.Controls.Image)(target));
                return;
            }
            this._contentLoaded = true;
        }
    //----< called by MainWindow to give this window her ref >-------

    public void setMainWindow(MainWindow mwin)
    {
      mWin = mwin;
    }
Example #14
0
        private static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                XmlConfigurator.Configure(new FileInfo("logconfig.xml"));

                Options.Options.setSettings(EFSSystem.INSTANCE);
                EFSSystem.INSTANCE.DictionaryChangesOnFileSystem += HandleInstanceDictionaryChangesOnFileSystem;

                MainWindow window = new MainWindow();
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

                {
                    // TRICKY SECTION
                    // This thread is mandatory otherwise WCF does not create a new thread to handle the service requests.
                    // Since the call to Cycle is blocking, creating such threads is mandatory
                    Thread thread = ThreadUtil.CreateThread("EFS Service", HostEfsService);
                    thread.Start();
                }

                foreach (string file in args)
                {
                    window.OpenFile(file);
                }
                Application.Run(window);
                CloseEfsService();
            }
            finally
            {
                Util.UnlockAllFiles();
            }

            EFSSystem.INSTANCE.Stop();
            SynchronizerList.Stop();
        }
        public delegate void SendMessage(String message);			// Allowing Reader to ask MainWindow to SendMessages

        public static void Run()
        {

            StreamReader reader = new StreamReader(_stream);
            String input;

            while (_active)
            {

                try
                {

                    if (_auction._socket.Connection.Connected)
                    {

                        input = reader.ReadLine().Trim();
                        if (input != null)
                        {
                            if (Handler.check_command(input))
                            {
                                String command = input;
                                if (Handler.regex_match(@"^([\/]{1})users\s", input))
                                {
                                    command = Handler.regex_replace(@"^([\/]{1})users\s", input, "");
                                    List<String> users = new List<String>(command.Split('#'));
                                    App.Current.Dispatcher.Invoke(new UpdateUsers(_auction.UpdateUserList), users);
                                }
                                if (Handler.regex_match(@"^([\/]{1})bye", input) && Handler.regex_match(@"^([\/]{1})disconnect", input))
                                {
                                    ClientWriter.Active = false;
                                }
                            }
                            else
                            {
                                App.Current.Dispatcher.Invoke(new SendMessage(_auction.ShowMessage), input);
                            }
                        }

                    }
                    else
                    {
                        _active = false;
                    }

                }
                catch (Exception)
                {
                    _active = false;
                    if (_auction._socket != null) _auction._socket.Disconnect();
                }

            }

            // Resets Values!
            _stream = null;
            _auction = null;
            _active = true;
        }
Example #16
0
 public addCategoryForm(string name, MainWindow mainWindow)
     : this()
 {
     oldName = name;
          mainForm = mainWindow;
 }
Example #17
0
        private void InitLogs(MainWindow window)
        {
            var textTarget = new WpfRichTextBoxTarget
            {
                Name = "WindowText",
                Layout = "${date:format=HH.mm.ss}: ${message}",
                ControlName = window.LogsRichTextBox.Name,
                FormName = GetType().Name,
                AutoScroll = true,
                MaxLines = 100000,
                UseDefaultRowColoringRules = true,
                Width = (int)window.LogsRichTextBox.Width
            };

            var stateTarget = new WpfRichTextBoxTarget
            {
                Name = "WindowState",
                Layout = "${message}",
                ControlName = window.StateString.Name,
                FormName = GetType().Name,
                MaxLines = 1,
                UseDefaultRowColoringRules = true,
                Width = (int)window.StateString.Width
            };

            var asyncTextWrapper = new AsyncTargetWrapper { Name = "WindowTextAsync", WrappedTarget = textTarget };
            var asyncStateWrapper = new AsyncTargetWrapper { Name = "WindowStateAsync", WrappedTarget = stateTarget };

            LogManager.Configuration.AddTarget(asyncTextWrapper.Name, asyncTextWrapper);
            LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, asyncTextWrapper));

            LogManager.Configuration.AddTarget(asyncStateWrapper.Name, asyncStateWrapper);
            LogManager.Configuration.LoggingRules.Insert(0, new LoggingRule("StateLogger", LogLevel.Trace, asyncStateWrapper) {Final = true});

            LogManager.ReconfigExistingLoggers();
        }