private void LogLink_RequestNavigate(object sender, RequestNavigateEventArgs e) { string link = Static.StaticData.Settings.LogFilePath; string executablePath = new PathCutHelper().GetExecutablePath(); link = string.Format(@"{0}\{1}", executablePath, link); if (System.IO.File.Exists(link) == false) this.LabelLogLink.IsEnabled = false; else System.Diagnostics.Process.Start(link); }
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 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 LogLink_RequestNavigate(object sender, RequestNavigateEventArgs e) { string link = Static.StaticData.Settings.LogFilePath; string executablePath = new PathCutHelper().GetExecutablePath(); link = string.Format(@"{0}\{1}", executablePath, link); if (System.IO.File.Exists(link) == false) { this.LabelLogLink.IsEnabled = false; } else { System.Diagnostics.Process.Start(link); } }
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(); } } } }
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"); }