public DefaultSkinForm() { InitializeComponent(); string imagePath = new PathCutHelper() .CutExecutableFileFromPath(System.Reflection.Assembly .GetExecutingAssembly().Location) + @"\minderico.ico"; this.MImage.Source = new BitmapImage(new Uri(imagePath)); this.ShowInTaskbar = false; }
private static void Starter(string[] args) { ConfigLoader.Load(); string log4netConfigPath = new PathCutHelper() .CutExecutableFileFromPath(System.Reflection.Assembly .GetExecutingAssembly().Location); log4netConfigPath += @"\Minder.log4net.xml"; FileInfo config = new FileInfo(log4netConfigPath); log4net.Config.XmlConfigurator.Configure(config); log4net.ILog logger = log4net.LogManager.GetLogger(typeof(BootStrap)); bool openForm = false; if(args != null) { foreach(string arg in args) { if(arg.ToLower().Equals("--openform")) openForm = true; } } SettingsLoader loader = new SettingsLoader(); loader.LoadSettings(); Minder.Static.StaticData.Settings.LogFilePath = @"Log\Minder.log"; UpdateDBVersion(); Info syncInfo = InfoFinder.FindByUniqueCode(Minder.Static.StaticData.InfoUniqueCodes.InfoLastSyncDate); if(syncInfo != null) Minder.Static.StaticData.Settings.Sync.LastSyncDate = Convert.ToDateTime(syncInfo.Value1); new StartWithWinController().StartWithWindows(); //if(Minder.Static.StaticData.Settings.CheckUpdates) // new UpdateProject(StaticData.VersionCache.Version, true, "Minder"); MainFormPreparer preparer = new MainFormPreparer(); if(openForm) preparer.PrepareForm(openForm); else preparer.PrepareForm(); MousePositionHelper mouseMoveChecker = new MousePositionHelper(); mouseMoveChecker.SartMouseMoveChecker(); TimeController timeController = new TimeController(preparer); timeController.Start(); logger.Info("Minder started"); }
private void PlaySound() { string soundPath = new PathCutHelper() .CutExecutableFileFromPath(System.Reflection.Assembly .GetExecutingAssembly().Location); soundPath += @"\" + StaticData.SOUND_FILE_PATH; SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); }
private void FormClosing(object sender, System.ComponentModel.CancelEventArgs e) { // Check or exist changes if (_existChanges != true) return; if (MessageBox.Show("Do you want to save changes?", "Settings", MessageBoxButton.YesNo) != MessageBoxResult.Yes) return; new SettingsLoader().SaveSettingsToFile(); if (MessageBox.Show("You need restart application to take efect. Do you want restart application now?", "Settings", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { string workingPath = new PathCutHelper() .CutExecutableFileFromPath(System.Reflection.Assembly .GetExecutingAssembly().Location); string starterPath = workingPath + @"\Minder.Starter.exe"; string minderPath = workingPath + @"\Minder.exe"; minderPath = minderPath.Insert(0, "\""); minderPath = minderPath.Insert(minderPath.Length, "\""); Process.Start(starterPath, string.Format("--openform --run {0} --sleep 2", minderPath)); Process[] proc = Process.GetProcessesByName("Minder"); if (proc.Length > 0) { foreach (Process proces in proc) { proces.Kill(); } } } }