Ejemplo n.º 1
0
        public override void Run()
        {
            Form f = (Form)WorkbenchSingleton.Workbench;

            foreach (string file in SplashScreenForm.GetRequestedFileList())
            {
                try
                {
                    IFileService fileService = (IFileService)ServiceManager.Services.GetService(typeof(IFileService));
                    fileService.OpenFile(file);
                    IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveViewContent;
                    if (viewContent != null)
                    {
                        viewContent.ViewSelected -= AlgorithmManager.Algorithms.ClearPadsHandler;
                        viewContent.ViewSelected += AlgorithmManager.Algorithms.ClearPadsHandler;
                        viewContent.SelectView();
                        AlgorithmManager.Algorithms.Timer.Enabled = false;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("不能打开文件: {0} 出现错误 :\n{1}", file, e.ToString());
                }
            }
            Application.Run(f);

            // 退出程序后,最后保存工作台的状态.
            PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));

            if (WorkbenchSingleton.Workbench is IMementoCapable)
            {
                IXmlConvertable workbenchStatus = ((IMementoCapable)WorkbenchSingleton.Workbench).CreateMemento();
                propertyService.SetProperty(workbenchMemento, workbenchStatus);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Displays the splashscreen
 /// </summary>
 public static void ShowSplashScreen()
 {
     if (sf == null)
     {
         sf = new SplashScreenForm();
         sf.ShowSplashScreen();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Closes the SplashScreen
 /// </summary>
 public static void CloseSplashScreen()
 {
     if (sf != null)
     {
         sf.CloseSplashScreen();
         sf = null;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Closes the SplashScreen
 /// </summary>
 public static void CloseSplashScreen()
 {
     if (splashScreen != null)
     {
         splashScreen.CloseSplashScreen();
         splashScreen = null;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Displays the Splash Screen
 /// </summary>
 public static void ShowSplashScreen()
 {
     if (splashScreen == null)
     {
         splashScreen = new SplashScreenForm();
         splashScreen.ShowSplashScreen();
     }
 }
Ejemplo n.º 6
0
        private void LogInFrom_Load(object sender, EventArgs e)
        {
            Ejecutar(() =>
            {
                logInViewModelBindingSource.DataSource = logInViewModel;

                SplashScreenForm splashScreenForm = new SplashScreenForm();
                splashScreenForm.ShowDialog();
            });
        }
Ejemplo n.º 7
0
 public LoginForm()
 {
     this.displayLogin = true;
     this.splashScreen = null;
     this.launchSplashThread();
     InitializeComponent();
     this.posNameLabel.Text    = "";
     this.loadStatusLabel.Text = "";
     this.showSalePointName();
     this.versionLabel.Text = UtilityService.getApplicationVersion();
 }
 /// <summary>
 /// Displays the splashscreen
 /// </summary>
 public static void ShowSplashScreen()
 {
     sf = new SplashScreenForm();
     if (BackgroundImage != null)
     {
         sf.Image.Image  = BackgroundImage;
         sf.Image.Height = 400;
         sf.Image.Width  = 640;
     }
     sf.ShowSplashScreen();
 }
Ejemplo n.º 9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // show splash
            SplashScreenForm splashScreenForm = new SplashScreenForm();

            splashScreenForm.Show();

            Task.Factory.StartNew(() =>
            {
                // empty
                splashScreenForm.SplashScreenText("Инициализация ...");
                System.Threading.Thread.Sleep(500);

                // db connect
                splashScreenForm.SplashScreenText("Соединение с базой данных ...");
                SessionsHelper.DatabaseConnect();

                /*
                 * // login form
                 * splashScreenForm.SplashScreenText("Идентификация пользователя ...");
                 * splashScreenForm.SplashScreenProgress(false);
                 * Application.Current.Dispatcher.Invoke((Action)delegate
                 * {
                 *  LoginFormViewModel loginFormViewModel = new LoginFormViewModel();
                 *  LoginForm loginForm = new LoginForm();
                 *  loginForm.Owner = splashScreenForm;
                 *  loginForm.DataContext = loginFormViewModel;
                 *  loginFormViewModel.OnRequestClose += (s, ee) => loginForm.Close();
                 *  var r = loginForm.ShowDialog();
                 * });
                 */

                SessionsHelper.CurrentUser = SessionsHelper.GetUsersList().First();

                if (SessionsHelper.CurrentUser != null)
                {
                    // empty
                    splashScreenForm.SplashScreenText("Применение параметров ...");
                    splashScreenForm.SplashScreenProgress(true);
                    System.Threading.Thread.Sleep(500);

                    this.Dispatcher.Invoke(() =>
                    {
                        base.OnStartup(e);
                        splashScreenForm.Close();
                    });
                }
                else
                {
                    Process.GetCurrentProcess().Kill();
                }
            });
        }
Ejemplo n.º 10
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     splashScreen = new SplashScreenForm();
     startForm    = new StartForm();
     selectForm   = new SelectForm();
     productForm  = new ProductForm();
     orderForm    = new OrderForm();
     product      = new Product();
     aboutBox     = new AboutBox();
     Application.Run(splashScreen);
 }
        private static void Main(string[] args)
        {
            Console.Title = "BriefingRoom output console";
            DebugLog.Instance.CreateLogFileWriter();

            using (INIFile ini = new INIFile($"{BRPaths.DATABASE}Common.ini"))
                TARGETED_DCS_WORLD_VERSION = ini.GetValue("Versions", "DCSVersion", "2.5");

            if (args.Length > 0)                // Command-line arguments are present, use the command-line tool
            {
                Database.Instance.Initialize(); // Called here in command-line mode, when in GUI mode function is called by the SplashScreen
                if (DebugLog.Instance.ErrorCount > 0)
                {
                    return;                                   // Errors found, abort! abort!
                }
                try
                {
                    using (CommandLineTool clt = new CommandLineTool())
                        clt.DoCommandLine(args);
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"ERROR: {ex.Message}");
                }

#if DEBUG
                Console.WriteLine();
                Console.WriteLine("Press any key to close this window");
                Console.ReadKey();
#endif
            }
            else // No command-line, use the GUI tool
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                // Display the splash screen while the database is being loaded
                using (SplashScreenForm splashScreen = new SplashScreenForm())
                {
                    splashScreen.ShowDialog();
                    if (splashScreen.AbortStartup)
                    {
                        return;
                    }
                }

                Application.Run(new MainForm());
            }

            DebugLog.Instance.CloseLogFileWriter();
        }
Ejemplo n.º 12
0
        private static void Main()
        {
            WinFormsApplication.EnableVisualStyles();
            WinFormsApplication.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.UnhandledException += (sender, e) => TearDown(e.IsTerminating, e.ExceptionObject as Exception);
            WinFormsApplication.ApplicationExit        += (sender, e) => TearDown(isTerminating: false, ex: null);

            // Initialize AppSettings file
            AppSettings.Instance.Save();

            ConfigureCompositionRoot();

            SplashScreenForm.Splash(() => _compositionRoot.Resolver.Resolve <SplashScreenForm>(), ExecuteBootstrapActions);
            WinFormsApplication.Run(_compositionRoot.Resolver.Resolve <MainForm>());
        }
Ejemplo n.º 13
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            product = new Product();
            //This intializes each of the forms
            splashScreenForm = new SplashScreenForm();
            startForm        = new StartForm();
            selectForm       = new SelectForm();
            productInfoForm  = new ProductInfoForm();
            orderForm        = new OrderForm();
            aboutForm        = new AboutForm();

            //Runs the Splash Screen First
            Application.Run(new SplashScreenForm());
        }
Ejemplo n.º 14
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            splashScreenForm        = new SplashScreenForm();
            startForm               = new StartForm();
            selectForm              = new SelectForm();
            productInfoForm         = new ProductInfoForm();
            orderForm               = new OrderForm();
            dollarComputersAboutBox = new DollarComputersAboutBox();

            product = new Product();

            Application.Run(new SplashScreenForm());
        }
Ejemplo n.º 15
0
        public static SplashScreenForm SplashScreenInstance()
        {
            SplashScreenForm currentSplashScreenInstance;

            if (!FormTypeIsOpen(typeof(SplashScreenForm)))
            {
                currentSplashScreenInstance = new SplashScreenForm();
                return(currentSplashScreenInstance);
            }
            else
            {
                currentSplashScreenInstance = (SplashScreenForm)FindFormByType(typeof(SplashScreenForm));
                if (currentSplashScreenInstance != null)
                {
                    return(currentSplashScreenInstance);
                }
            }
            return(null);
        }
Ejemplo n.º 16
0
        public static void Main(string[] args)
        {
            SplashScreenForm.SetCommandLineArgs(args);
            SplashScreenForm.SplashScreen.Show();
            Application.ThreadException += new ThreadExceptionEventHandler(ShowErrorBox);
            ArrayList commands = null;

            try
            {
                string[] addInDirectories = AddInSettingsHandler.GetAddInDirectories();
                AddInTreeSingleton.SetAddInDirectories(addInDirectories);

                commands = AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Autostart").BuildChildItems(null);
                for (int i = 0; i < commands.Count - 1; ++i)
                {
                    ((ICommand)commands[i]).Run();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (SplashScreenForm.SplashScreen != null)
                {
                    SplashScreenForm.SplashScreen.Close();
                }
            }

            try
            {
                if (commands.Count > 0)
                {
                    ((ICommand)commands[commands.Count - 1]).Run();
                }
            }
            finally
            {
                ServiceManager.Services.UnloadAllServices();
            }
        }
Ejemplo n.º 17
0
        private void Form1_Load(object sender, EventArgs e)
        {
            #region Splash Screen Load
            lblCountdown.Text = "";
            //toolStrip1.Renderer = new ToolStripRenderPro();
            //toolStrip2.Renderer = new ToolStripRenderPro();
            //toolStrip3.Renderer = new ToolStripRenderPro();
            //toolStrip4.Renderer = new ToolStripRenderPro();
            var sf = new SplashScreenForm(); // Splash Screen
            SplashScreen.UdpateStatusText("Loading Items...");
            SplashScreen.UdpateStatusTextWithStatus("Loading Defaults", TypeOfMessage.Success);
            SplashScreen.UdpateStatusText("Complete");

            txtVersion.Text = @"v " + "3.4.2.0";
            SetBindings();
            //lblTime.DataBindings.Add(new Binding("Text", AppSettings.Instance.CurrentAuction, "EndDate", false, DataSourceUpdateMode.OnPropertyChanged));

            Show();
            SplashScreen.CloseSplashScreen();
            Activate();

            #endregion
        }
Ejemplo n.º 18
0
    //private bool statusSplash = false;
    /*bool update_status ()
     	{
         	statusSplash = splash.WaitingSplash;
         	return true;
     	}*/
    public MainWindow(string[] arguments)
        : base(Gtk.WindowType.Toplevel)
    {
        this.HeightRequest = this.Screen.Height;//-50;
        this.WidthRequest = this.Screen.Width;//-50;

        bool showSplash = true;
        bool openFileFromArg = false;
        string openFileAgument = "";
        for (int i = 0; i < arguments.Length; i++){
            Logger.LogDebugInfo("arg->{0}",arguments[i]);

            string arg = arguments[i];
            if (arg.StartsWith("-nosplash")){
                if (arg == "-nosplash")
                    showSplash = false;
            }
            if(!arg.EndsWith(".exe")){ // argument file msw
                if(File.Exists(arg)){
                    openFileAgument =arg;
                    if(arg.ToLower().EndsWith(".msw"))
                        openFileFromArg = true;
                }
            }
        }

        StringBuilder sbError = new StringBuilder();
        if(!File.Exists(MainClass.Settings.FilePath)){

            if(showSplash)
                splash = new SplashScreenForm(false);

            //statusSplash = true;
            Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("Setting inicialize -{0}",DateTime.Now));
            string file = System.IO.Path.Combine(MainClass.Paths.SettingDir, "keybinding");
            if(MainClass.Platform.IsMac){
                Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsMac(file);
            } else{
                Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsWin(file);
            }
            MainClass.Settings.SaveSettings();

        } else {
            if(showSplash)
                splash = new SplashScreenForm(false);
        }

        if(MainClass.Platform.IsMac){
                ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) {
                    Application.Quit ();
                    e.Handled = true;
                };

                ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                    MainClass.MainWindow.Deiconify ();
                    MainClass.MainWindow.Visible = true;
                    e.Handled = true;
                };
        }

        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.show-{0}",DateTime.Now));
        Console.WriteLine(String.Format("splash.show-{0}",DateTime.Now));

        if(showSplash)
            splash.ShowAll();
        StockIconsManager.Initialize();
        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.start-{0}",DateTime.Now));
        Build();
        this.Maximize();

        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.end-{0}",DateTime.Now));

        this.llcLogin = new LoginLogoutControl();
        this.llcLogin.Events = ((Gdk.EventMask)(256));
        this.llcLogin.Name = "llcLogin";
        this.statusbar1.Add (this.llcLogin);
        Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.statusbar1 [this.llcLogin]));
        w14.Position = 2;
        w14.Expand = false;
        w14.Fill = false;

        SetSettingColor();

        lblMessage1.Text="";
        lblMessage2.Text="";
        if (String.IsNullOrEmpty(MainClass.Paths.TempDir))
        {

            MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_create_temp"),MainClass.Paths.TempDir, Gtk.MessageType.Error,null);
            md.ShowDialog();
            return;
        }
        string fullpath = MainClass.Paths.StylesDir;

        bool success = true;

        if (!Directory.Exists(fullpath))
            try {
                Directory.CreateDirectory(fullpath);
            } catch {
                success = false;
            }
        if (success){
            try {
                Mono.TextEditor.Highlighting.SyntaxModeService.LoadStylesAndModes(fullpath);
            } catch(Exception ex) {
                sbError.AppendLine("ERROR: " + ex.Message);
                Logger.Log(ex.Message);
            }
        }

        ActionUiManager.UI.AddWidget += new AddWidgetHandler(OnWidgetAdd);
        ActionUiManager.UI.ConnectProxy += new ConnectProxyHandler(OnProxyConnect);
        ActionUiManager.LoadInterface();
        this.AddAccelGroup(ActionUiManager.UI.AccelGroup);

        WorkspaceTree = new WorkspaceTree();
        FrameworkTree = new FrameworkTree();

        FileExplorer = new FileExplorer();

        FileNotebook.AppendPage(WorkspaceTree, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("projects")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.AppendPage(FrameworkTree, new NotebookLabel("libs.png",MainClass.Languages.Translate("libs")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.AppendPage(FileExplorer, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("files")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.CurrentPage = 1;

        hpBodyMidle.Pack1(FileNotebook, false, true);
        hpRight = new HPaned();
        //hpRight.Fi

        hpRight.Pack1(EditorNotebook, true, true);
        hpRight.Pack2(PropertisNotebook, false, true);
        hpBodyMidle.Pack2(hpRight, true, true);
        FileNotebook.WidthRequest = 500;
        hpBodyMidle.ResizeMode = ResizeMode.Queue;

        try {
            ActionUiManager.SocetServerMenu();
            ActionUiManager.RecentAll(MainClass.Settings.RecentFiles.GetFiles(),
                                      MainClass.Settings.RecentFiles.GetProjects(),
                                                      MainClass.Settings.RecentFiles.GetWorkspace());
        } catch {
        }

        ddbProject = new DropDownButton();
        ddbProject.Changed+= OnChangedProject;
        ddbProject.WidthRequest = 175;
        ddbProject.SetItemSet(projectItems);

        ddbDevice = new DropDownButton();
        ddbDevice.Changed+= OnChangedDevice;
        ddbDevice.WidthRequest = 175;
        ddbDevice.SetItemSet(deviceItems);

        ddbResolution = new DropDownButton();
        ddbResolution.Changed+= OnChangedResolution;
        ddbResolution.WidthRequest = 175;
        ddbResolution.SetItemSet(resolutionItems);

        ReloadSettings(false);
        OpenFile("StartPage",false);

        PageIsChanged("StartPage");

        if ((MainClass.Settings.Account != null) && (MainClass.Settings.Account.Remember)){
            MainClass.User = MainClass.Settings.Account;
        } else {
            MainClass.User = null;
        }

        SetLogin();

        OutputConsole = new OutputConsole();

        Gtk.Menu outputMenu = new Gtk.Menu();
        GetOutputMenu(ref outputMenu);

        BookmarkOutput = new BookmarkOutput();

        OutputNotebook.AppendPage(OutputConsole, new NotebookMenuLabel("console.png",MainClass.Languages.Translate("console"),outputMenu));
        OutputNotebook.AppendPage(FindReplaceControl, new NotebookLabel("find.png",MainClass.Languages.Translate("find")));
        OutputNotebook.AppendPage(BookmarkOutput, new NotebookLabel("bookmark.png",MainClass.Languages.Translate("bookmarks")));

        LogMonitor = new LogMonitor();
        Gtk.Menu monMenu = new Gtk.Menu();
        GetOutputMenu(ref monMenu, LogMonitor);

        OutputNotebook.AppendPage(LogMonitor, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("Monitor"),monMenu));

        LogGarbageCollector = new LogGarbageCollector();
        Gtk.Menu gcMenu = new Gtk.Menu();
        GetOutputMenu(ref gcMenu, LogGarbageCollector);

        garbageColectorLabel =new NotebookMenuLabel("garbage-collector.png",MainClass.Languages.Translate("garbage_collector",0),gcMenu);

        OutputNotebook.AppendPage(LogGarbageCollector,garbageColectorLabel );

        hpOutput.Add1(OutputNotebook);

        ProcessOutput = new ProcessOutput();
        Gtk.Menu taskMenu = new Gtk.Menu();
        GetOutputMenu(ref taskMenu, ProcessOutput);
        TaskNotebook.AppendPage(ProcessOutput, new NotebookMenuLabel("task.png",MainClass.Languages.Translate("process"),taskMenu));

        ErrorOutput = new ErrorOutput();
        Gtk.Menu errorMenu = new Gtk.Menu();
        GetOutputMenu(ref errorMenu, ErrorOutput);
        TaskNotebook.AppendPage(ErrorOutput, new NotebookMenuLabel("error.png",MainClass.Languages.Translate("errors"),errorMenu));

        LogOutput = new LogOutput();
        Gtk.Menu logMenu = new Gtk.Menu();
        GetOutputMenu(ref logMenu, LogOutput);
        TaskNotebook.AppendPage(LogOutput, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("logs"),logMenu));

        TodoOutput = new TodoOutput();
        TaskNotebook.AppendPage(TodoOutput, new NotebookLabel("task.png",MainClass.Languages.Translate("task")));

        FindOutput = new FindOutput();
        Gtk.Menu findMenu = new Gtk.Menu();
        GetOutputMenu(ref findMenu, FindOutput);
        TaskNotebook.AppendPage(FindOutput, new NotebookMenuLabel("find.png",MainClass.Languages.Translate("find_result"),findMenu));

        hpOutput.Add2(TaskNotebook);
        FirstShow();

        EditorNotebook.PageIsChanged +=PageIsChanged;

        if (openFileFromArg){ // open workspace from argument file
         	Workspace workspace = Workspace.OpenWorkspace(openFileAgument);
            Console.WriteLine("Open File From Arg");
            if (workspace != null){
                ReloadWorkspace(workspace, false,false);
                Console.WriteLine("RecentFiles");
                MainClass.Settings.RecentFiles.AddWorkspace(workspace.FilePath, workspace.FilePath);
                ActionUiManager.RefreshRecentAll(MainClass.Settings.RecentFiles.GetFiles(),
                                      MainClass.Settings.RecentFiles.GetProjects(),
                                         MainClass.Settings.RecentFiles.GetWorkspace());
            } else
                openFileFromArg = false;
        } else if((MainClass.Settings.OpenLastOpenedWorkspace) && !openFileFromArg ){
            if(String.IsNullOrEmpty(MainClass.Workspace.FilePath) && (String.IsNullOrEmpty(MainClass.Settings.CurrentWorkspace) ) ){
                /*MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_is_corrupted"), null, Gtk.MessageType.Error,null);
                    md.ShowDialog();*/
                MainClass.Settings.CurrentWorkspace = "";
            } else{
                ReloadWorkspace(MainClass.Workspace, false,false);
            }
        } else if(!MainClass.Settings.OpenLastOpenedWorkspace && (!openFileFromArg) ){
            MainClass.Workspace = new Workspace();
            MainClass.Settings.CurrentWorkspace = "";
        }

        if(!String.IsNullOrEmpty(openFileAgument)){
            if(!openFileAgument.ToLower().EndsWith(".msw"))
                OpenFile(openFileAgument,true);
        }

        EditorNotebook.Page=0;

        WorkspaceTree.FileIsSelected+= delegate(string fileName, int fileType,string appFileName) {

            if(String.IsNullOrEmpty(fileName)){
                SetSensitiveMenu(false);
                return;
            }
            ActionUiManager.SetSensitive("propertyall",true);

            SetSensitiveMenu(true);

            if(MainClass.Settings.AutoSelectProject){

                if((TypeFile)fileType == TypeFile.AppFile)
                    SetActualProject(fileName);
                else if (!String.IsNullOrEmpty(appFileName))
                    SetActualProject(appFileName);
            }//PropertisNotebook
            PropertisNotebook.RemovePage(0);
            if((TypeFile)fileType == TypeFile.SourceFile || ((TypeFile)fileType == TypeFile.StartFile )
               || ((TypeFile)fileType == TypeFile.ExcludetFile ) ){
                string file = "";
                string appfile = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file))
                    return;

                appfile = WorkspaceTree.GetSelectedProjectApp();

                Project p = MainClass.Workspace.FindProject_byApp(appfile, true);
                if (p == null)
                    return;

                FilePropertisData fpd = new FilePropertisData();
                fpd.Filename = MainClass.Workspace.GetRelativePath(file);
                fpd.Project = p;

                FilePropertyWidget fpw = new FilePropertyWidget( fpd);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            }else  if ((TypeFile)fileType == TypeFile.Directory){

                string file = "";
                string appfile = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file)) return;

                appfile = WorkspaceTree.GetSelectedProjectApp();

                Project p = MainClass.Workspace.FindProject_byApp(appfile, true);
                if (p == null)
                    return;

                FilePropertisData fpd = new FilePropertisData();
                fpd.Filename = MainClass.Workspace.GetRelativePath(file);
                fpd.Project = p;

                DirPropertyWidget fpw = new DirPropertyWidget( fpd);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            }else  if ((TypeFile)fileType == TypeFile.AppFile){

                string file = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file)) return;

                Project p = MainClass.Workspace.FindProject_byApp(file, true);
                if (p == null)
                    return;

                ProjectPropertyWidget fpw = new ProjectPropertyWidget( p);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            } else{

            }
        };

        SetSensitiveMenu(false);

        string newUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe.new");

        if(System.IO.File.Exists(newUpdater)){

            string oldUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe");
            try{
                if(File.Exists(oldUpdater))
                    File.Delete(oldUpdater);

                  File.Copy(newUpdater,oldUpdater);

                  File.Delete(newUpdater);
            }catch(Exception ex){
                sbError.AppendLine("WARNING: " + ex.Message);
                Logger.Error(ex.Message);
            }
        }

        Gtk.Drag.DestSet (this, 0, null, 0);
        this.DragDrop += delegate(object o, DragDropArgs args) {

            Gdk.DragContext dc=args.Context;

            foreach (object k in dc.Data.Keys){
                Console.WriteLine(k);
            }
            foreach (object v in dc.Data.Values){
                Console.WriteLine(v);
            }

            Atom [] targets = args.Context.Targets;
            foreach (Atom a in targets){
                if(a.Name == "text/uri-list")
                    Gtk.Drag.GetData (o as Widget, dc, a, args.Time);
            }
        };

        this.DragDataReceived += delegate(object o, DragDataReceivedArgs args) {

            if(args.SelectionData != null){
                string fullData = System.Text.Encoding.UTF8.GetString (args.SelectionData.Data);

                foreach (string individualFile in fullData.Split ('\n')) {
                    string file = individualFile.Trim ();
                    if (file.StartsWith ("file://")) {
                        file = new Uri(file).LocalPath;

                        try {
                            OpenFile(file,true);
                        } catch (Exception e) {
                            sbError.AppendLine("ERROR: " + String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString()));
                            Logger.Error(String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString()));
                        }
                    }
                }
            }
        };
        //table1.Attach(ddbSocketIP,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0);
        this.ShowAll();
        //this.Maximize();

        int x, y, w, h, d = 0;
        hpOutput.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        hpOutput.Position = w / 2;

        //vpMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        tblMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        tblMenuRight.RowSpacing = 0;
        tblMenuRight.ColumnSpacing = 0;
        tblMenuRight.BorderWidth = 0;
        if(w<1200){
            //vpMenuRight.WidthRequest =125;
            tblMenuRight.WidthRequest =220;
        } else {
            if(MainClass.Platform.IsMac)
                tblMenuRight.WidthRequest =320;
            else
                tblMenuRight.WidthRequest =300;
        }

        if (MainClass.Platform.IsMac) {
            try{
                ActionUiManager.CreateMacMenu(mainMenu);

            } catch (Exception ex){
                sbError.AppendLine(String.Format("ERROR: Mac IGE Main Menu failed."+ex.Message));
                Logger.Error("Mac IGE Main Menu failed."+ex.Message,null);
            }
        }
        ReloadPanel();
        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.hide-{0}",DateTime.Now));
        // Send message to close splash screen on win
        Console.WriteLine(String.Format("splash.hide-{0}",DateTime.Now));

        if(showSplash)
            splash.HideAll();

        EditorNotebook.OnLoadFinish = true;

        OutputConsole.WriteError(sbError.ToString());

        Moscrif.IDE.Iface.SocketServer.OutputClientChanged+= delegate(object sndr, string message) {
            Gtk.Application.Invoke(delegate{
                    this.OutputConsole.WriteText(message);
                    Console.WriteLine(message);
                });
        };

        Thread ExecEditorThreads = new Thread(new ThreadStart(ExecEditorThreadLoop));

        ExecEditorThreads.Name = "ExecEditorThread";
        ExecEditorThreads.IsBackground = true;
        ExecEditorThreads.Start();
        //LoadDefaultBanner();

        toolbarBanner = new Toolbar ();
        toolbarBanner.WidthRequest = 220;
        tblMenuRight.Attach(toolbarBanner,0,1,0,2,AttachOptions.Fill,AttachOptions.Expand|AttachOptions.Fill,0,0);

        bannerImage.WidthRequest = 200;
        bannerImage.HeightRequest = 40;

        toolbarBanner.Add(bannerImage);//(bannerButton);
        toolbarBanner.ShowAll();
        LoadDefaultBanner();

        //bannerImage.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand2);

        Thread BannerThread = new Thread(new ThreadStart(BannerThreadLoop));

        BannerThread.Name = "BannerThread";
        BannerThread.IsBackground = true;
        BannerThread.Start();
    }
Ejemplo n.º 19
0
 private void closeSplashScreen()
 {
     this.splashScreen.DisposeForm();
     this.splashScreen = null;
 }
Ejemplo n.º 20
0
 private void launchSplashScreen()
 {
     this.splashScreen = new SplashScreenForm();
     LoginForm.waitHandle.Set();
     Application.Run(this.splashScreen);
 }
Ejemplo n.º 21
0
        int Run(MonoDevelopOptions options)
        {
            LoggingService.LogInfo("Starting {0} {1}", BrandingService.ApplicationName, IdeVersionInfo.MonoDevelopVersion);
            LoggingService.LogInfo("Running on {0}", IdeVersionInfo.GetRuntimeInfo());

            Counters.Initialization.BeginTiming();

            if (options.PerfLog)
            {
                string logFile = Path.Combine(Environment.CurrentDirectory, "monodevelop.perf-log");
                LoggingService.LogInfo("Logging instrumentation service data to file: " + logFile);
                InstrumentationService.StartAutoSave(logFile, 1000);
            }

            //ensure native libs initialized before we hit anything that p/invokes
            Platform.Initialize();

            Counters.Initialization.Trace("Initializing GTK");
            if (Platform.IsWindows && !CheckWindowsGtk())
            {
                return(1);
            }
            SetupExceptionManager();

            try {
                GLibLogging.Enabled = true;
            } catch (Exception ex) {
                LoggingService.LogError("Error initialising GLib logging.", ex);
            }

            SetupTheme();

            var args = options.RemainingArgs.ToArray();

            Gtk.Application.Init(BrandingService.ApplicationName, ref args);

            LoggingService.LogInfo("Using GTK+ {0}", IdeVersionInfo.GetGtkVersion());

            // XWT initialization
            FilePath p = typeof(IdeStartup).Assembly.Location;

            Assembly.LoadFrom(p.ParentDirectory.Combine("Xwt.Gtk.dll"));
            Xwt.Application.InitializeAsGuest(Xwt.ToolkitType.Gtk);
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarWindowBackend, GtkExtendedTitleBarWindowBackend> ();
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarDialogBackend, GtkExtendedTitleBarDialogBackend> ();

            //default to Windows IME on Windows
            if (Platform.IsWindows && Mono.TextEditor.GtkWorkarounds.GtkMinorVersion >= 16)
            {
                var settings = Gtk.Settings.Default;
                var val      = Mono.TextEditor.GtkWorkarounds.GetProperty(settings, "gtk-im-module");
                if (string.IsNullOrEmpty(val.Val as string))
                {
                    Mono.TextEditor.GtkWorkarounds.SetProperty(settings, "gtk-im-module", new GLib.Value("ime"));
                }
            }

            InternalLog.Initialize();
            string   socket_filename = null;
            EndPoint ep = null;

            DispatchService.Initialize();

            // Set a synchronization context for the main gtk thread
            SynchronizationContext.SetSynchronizationContext(new GtkSynchronizationContext());
            Runtime.MainSynchronizationContext = SynchronizationContext.Current;

            AddinManager.AddinLoadError += OnAddinError;

            var startupInfo = new StartupInfo(args);

            // If a combine was specified, force --newwindow.

            if (!options.NewWindow && startupInfo.HasFiles)
            {
                Counters.Initialization.Trace("Pre-Initializing Runtime to load files in existing window");
                Runtime.Initialize(true);
                foreach (var file in startupInfo.RequestedFileList)
                {
                    if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile(file.FileName))
                    {
                        options.NewWindow = true;
                        break;
                    }
                }
            }

            Counters.Initialization.Trace("Initializing Runtime");
            Runtime.Initialize(true);


            IdeApp.Customizer = options.IdeCustomizer ?? new IdeCustomizer();

            Counters.Initialization.Trace("Initializing theme and splash window");

            DefaultTheme = Gtk.Settings.Default.ThemeName;
            string theme = IdeApp.Preferences.UserInterfaceTheme;

            if (string.IsNullOrEmpty(theme))
            {
                theme = DefaultTheme;
            }
            ValidateGtkTheme(ref theme);
            if (theme != DefaultTheme)
            {
                Gtk.Settings.Default.ThemeName = theme;
            }


            //don't show the splash screen on the Mac, so instead we get the expected "Dock bounce" effect
            //this also enables the Mac platform service to subscribe to open document events before the GUI loop starts.
            if (Platform.IsMac)
            {
                options.NoSplash = true;
            }

            IProgressMonitor monitor = null;

            if (!options.NoSplash)
            {
                try {
                    monitor = new SplashScreenForm();
                    ((SplashScreenForm)monitor).ShowAll();
                } catch (Exception ex) {
                    LoggingService.LogError("Failed to create splash screen", ex);
                }
            }
            if (monitor == null)
            {
                monitor = new MonoDevelop.Core.ProgressMonitoring.ConsoleProgressMonitor();
            }

            monitor.BeginTask(GettextCatalog.GetString("Starting {0}", BrandingService.ApplicationName), 2);

            //make sure that the platform service is initialised so that the Mac platform can subscribe to open-document events
            Counters.Initialization.Trace("Initializing Platform Service");
            DesktopService.Initialize();

            monitor.Step(1);

            if (options.IpcTcp)
            {
                listen_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                ep            = new IPEndPoint(IPAddress.Loopback, ipcBasePort + HashSdbmBounded(Environment.UserName));
            }
            else
            {
                socket_filename = "/tmp/md-" + Environment.GetEnvironmentVariable("USER") + "-socket";
                listen_socket   = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
                ep = new UnixEndPoint(socket_filename);
            }

            // If not opening a combine, connect to existing monodevelop and pass filename(s) and exit
            if (!options.NewWindow && startupInfo.HasFiles)
            {
                try {
                    StringBuilder builder = new StringBuilder();
                    foreach (var file in startupInfo.RequestedFileList)
                    {
                        builder.AppendFormat("{0};{1};{2}\n", file.FileName, file.Line, file.Column);
                    }
                    listen_socket.Connect(ep);
                    listen_socket.Send(Encoding.UTF8.GetBytes(builder.ToString()));
                    return(0);
                } catch {
                    // Reset the socket
                    if (null != socket_filename && File.Exists(socket_filename))
                    {
                        File.Delete(socket_filename);
                    }
                }
            }

            Counters.Initialization.Trace("Checking System");
            string version = Assembly.GetEntryAssembly().GetName().Version.Major + "." + Assembly.GetEntryAssembly().GetName().Version.Minor;

            if (Assembly.GetEntryAssembly().GetName().Version.Build != 0)
            {
                version += "." + Assembly.GetEntryAssembly().GetName().Version.Build;
            }
            if (Assembly.GetEntryAssembly().GetName().Version.Revision != 0)
            {
                version += "." + Assembly.GetEntryAssembly().GetName().Version.Revision;
            }

            CheckFileWatcher();

            Exception error            = null;
            int       reportedFailures = 0;

            try {
                Counters.Initialization.Trace("Loading Icons");
                //force initialisation before the workbench so that it can register stock icons for GTK before they get requested
                ImageService.Initialize();

                if (errorsList.Count > 0)
                {
                    if (monitor is SplashScreenForm)
                    {
                        ((SplashScreenForm)monitor).Hide();
                    }
                    AddinLoadErrorDialog dlg = new AddinLoadErrorDialog((AddinError[])errorsList.ToArray(typeof(AddinError)), false);
                    if (!dlg.Run())
                    {
                        return(1);
                    }
                    if (monitor is SplashScreenForm)
                    {
                        ((SplashScreenForm)monitor).Show();
                    }
                    reportedFailures = errorsList.Count;
                }

                // no alternative for Application.ThreadException?
                // Application.ThreadException += new ThreadExceptionEventHandler(ShowErrorBox);

                Counters.Initialization.Trace("Initializing IdeApp");
                IdeApp.Initialize(monitor);

                // Load requested files
                Counters.Initialization.Trace("Opening Files");
                IdeApp.OpenFiles(startupInfo.RequestedFileList);

                monitor.Step(1);
            } catch (Exception e) {
                error = e;
            } finally {
                monitor.Dispose();
            }

            if (error != null)
            {
                LoggingService.LogFatalError(null, error);
                string message = BrandingService.BrandApplicationName(GettextCatalog.GetString(
                                                                          "MonoDevelop failed to start. The following error has been reported: {0}",
                                                                          error.Message
                                                                          ));
                MessageService.ShowException(error, message);
                return(1);
            }

            if (errorsList.Count > reportedFailures)
            {
                AddinLoadErrorDialog dlg = new AddinLoadErrorDialog((AddinError[])errorsList.ToArray(typeof(AddinError)), true);
                dlg.Run();
            }

            errorsList = null;

            // FIXME: we should probably track the last 'selected' one
            // and do this more cleanly
            try {
                listen_socket.Bind(ep);
                listen_socket.Listen(5);
                listen_socket.BeginAccept(new AsyncCallback(ListenCallback), listen_socket);
            } catch {
                // Socket already in use
            }

            initialized = true;
            MessageService.RootWindow = IdeApp.Workbench.RootWindow;
            Thread.CurrentThread.Name = "GUI Thread";
            Counters.Initialization.Trace("Running IdeApp");
            Counters.Initialization.EndTiming();

            AddinManager.AddExtensionNodeHandler("/MonoDevelop/Ide/InitCompleteHandlers", OnExtensionChanged);
            StartLockupTracker();
            IdeApp.Run();

            // unloading services
            if (null != socket_filename)
            {
                File.Delete(socket_filename);
            }
            lockupCheckRunning = false;
            Runtime.Shutdown();
            InstrumentationService.Stop();
            AddinManager.AddinLoadError -= OnAddinError;

            return(0);
        }
Ejemplo n.º 22
0
 public SplashScreen()
 {
     // We don't show the form right away, because we want to handle showing manually for reasons of
     // setting the theme and whatever else
     _splashScreenForm = new SplashScreenForm();
 }
Ejemplo n.º 23
0
        /// <summary>
        /// only try to login if already done before
        /// </summary>
        public Boolean ConditionalLogIn()
        {
            Boolean retValue = false;

            try
            {
                switch (CompanionStatus)
                {
                case LoginStatus.NotSet:
                    break;

                case LoginStatus.Ok:
                case LoginStatus.NotAccessible:
                    var profileExists = Program.CompanionIO.LoadProfile(Program.DBCon.getIniValue(CompanioDataView.DB_GROUPNAME, "EmailAddress"));
                    if (profileExists)
                    {
                        var loginResult = Login();

                        if (loginResult.Status != LoginStatus.Ok)
                        {
                            CompanionStatus = LoginStatus.NotSet;

                            SplashScreenForm.SetTopmost(false);

                            MessageBox.Show(SplashScreenForm.GetPrimaryGUI(Program.MainForm),
                                            "Warning: can't connect to companion server : <" + loginResult.Status.ToString() + ">",
                                            "Companion Interface",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Exclamation);

                            SplashScreenForm.SetTopmost(true);
                        }
                        else
                        {
                            retValue = true;
                        }
                    }
                    else
                    {
                        CompanionStatus = LoginStatus.NotSet;
                    }
                    break;

                case LoginStatus.PendingVerification:
                    CompanionStatus = LoginStatus.NotSet;
                    break;

                case LoginStatus.IncorrectCredentials:
                    CompanionStatus = LoginStatus.NotSet;
                    break;

                case LoginStatus.UnknownError:
                    CompanionStatus = LoginStatus.NotSet;
                    break;

                default:
                    break;
                }

                return(retValue);
            }
            catch (Exception ex)
            {
                throw new Exception("Error while logging in", ex);
            }
        }