コード例 #1
0
ファイル: App.xaml.cs プロジェクト: OccupyApollo/Apollo
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Check if another Planz instance exists
            //try
            //{
            //    System.Diagnostics.Process planz_proc = System.Diagnostics.Process.GetProcessesByName(ProcessList.Planz.ToString()).FirstOrDefault();
            //    if (planz_proc != null)
            //    {
            //        Microsoft.VisualBasic.Interaction.AppActivate(planz_proc.Id);
            //        return;
            //    }
            //}
            //catch (Exception)
            //{

            //}

            MainWindow mainWindow;
            if(e.Args.Length>0 && Directory.Exists(e.Args[0].ToString()))
            {
                mainWindow = new MainWindow(e.Args[0].ToString() + System.IO.Path.DirectorySeparatorChar);
            }else
            {
                mainWindow = new MainWindow();
            }

            mainWindow.Show();
        }
コード例 #2
0
        private void AssociationDropDownMenu_Open(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;
            Element element = mi.DataContext as Element;
            try
            {
                if (element != null)
                {
                    if (element.IsHeading)
                    {
                        MainWindow newWindow = new MainWindow(element.Path);
                        newWindow.Show();
                    }
                    else
                    {
                        if (element.AssociationType == ElementAssociationType.Email && elementControl.IsICCEmail(element))
                        {
                            elementControl.FindSentEmail(element);
                        }
                        System.Diagnostics.Process.Start(element.AssociationURIFullPath);
                    }

                    LogControl.Write(
                        element,
                        LogEventAccess.AssociationContextMenu,
                        LogEventType.Open,
                        LogEventStatus.NULL,
                        null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oops!\nSomething unexpected happened, please close this Planz window and reopen.");
                //MessageBox.Show("AssociationDropDownMenu_Open\n" + ex.Message);

                LogControl.Write(
                    element,
                    LogEventAccess.AssociationContextMenu,
                    LogEventType.Open,
                    LogEventStatus.Error,
                    LogEventInfo.ErrorMessage + LogControl.COMMA + ex.Message);
            }
        }
コード例 #3
0
        private void RibbonButton_NewWindow_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Change the window focus and reload the window
                string newWindowStartPath = string.Empty;

                if (previousChangeFocusFolder == null)
                {
                    if (startPath != StartProcess.START_PATH)
                        newWindowStartPath = StartProcess.START_PATH;

                    if (startPath != StartProcess.JOURNAL_PATH)
                        newWindowStartPath = StartProcess.JOURNAL_PATH;
                }
                else
                    newWindowStartPath = previousChangeFocusFolder;

                previousChangeFocusFolder = this.startPath;

                MainWindow newWindow = new MainWindow(newWindowStartPath);
                newWindow.Show();

                RibbonCommandNewWindow_Executed(null, null);

                LogControl.Write(
                   elementControl.CurrentElement,
                   LogEventAccess.Ribbon,
                   LogEventType.NewWindow,
                   LogEventStatus.NULL,
                   LogEventInfo.Location + LogControl.COMMA + newWindowStartPath);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oops!\nSomething unexpected happened, please close this Planz window and reopen.");
                //MessageBox.Show("RibbonButton_NewWindow_Click\n" + ex.Message);

                LogControl.Write(
                   elementControl.CurrentElement,
                   LogEventAccess.Ribbon,
                   LogEventType.NewWindow,
                   LogEventStatus.Error,
                   LogEventInfo.ErrorMessage + LogControl.COMMA + ex.Message);
            }
        }
コード例 #4
0
        private void RibbonButton_NewWindowMenuItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string des = String.Empty;

                MenuItem mi = sender as MenuItem;
                if (System.IO.Directory.Exists(mi.Tag.ToString()))
                {
                    previousNewWindowFolder = mi.Tag.ToString();
                    des = mi.Tag.ToString();
                }
                else if (mi.Tag.ToString() == "FolderSelectDialog")
                {
                    System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
                    dialog.SelectedPath = StartProcess.LIFE_PATH;
                    dialog.ShowNewFolderButton = true;
                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string folderPath = dialog.SelectedPath;
                        des = folderPath;

                        bool dup = false;
                        foreach (MenuItem menuItem in RibbonButton_NewWindow.Items)
                        {
                            if (menuItem.Tag.ToString() == folderPath)
                            {
                                dup = true;
                                break;
                            }
                        }
                        if (!dup)
                        {
                            previousNewWindowFolder = folderPath;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                if (des.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) == false)
                {
                    des += System.IO.Path.DirectorySeparatorChar;
                }

                string newWindowStartPath = des;

                MainWindow newWindow = new MainWindow(newWindowStartPath);

                newWindow.Show();

                RibbonCommandNewWindow_Executed(null, null);

                LogControl.Write(
                   elementControl.CurrentElement,
                   LogEventAccess.Ribbon,
                   LogEventType.NewWindow,
                   LogEventStatus.NULL,
                   LogEventInfo.Location + LogControl.COMMA + des);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oops!\nSomething unexpected happened, please close this Planz window and reopen.");
                //MessageBox.Show("RibbonButton_NewWindowMenuItem_Click\n" + ex.Message);

                LogControl.Write(
                   elementControl.CurrentElement,
                   LogEventAccess.Ribbon,
                   LogEventType.NewWindow,
                   LogEventStatus.Error,
                   LogEventInfo.ErrorMessage + LogControl.COMMA + ex.Message);
            }
        }
コード例 #5
0
        private void AssociationDropDownMenu_Execute(object sender, RoutedEventArgs e)
        {
            Element element = null;
            if (sender is MenuItem)
            {
                MenuItem mi = sender as MenuItem;
                element = mi.DataContext as Element;
            }
            else if (sender is Wpf.Controls.SplitButton)
            {
                Wpf.Controls.SplitButton sb = sender as Wpf.Controls.SplitButton;
                Image image = sb.Content as Image;
                element = GetElement(image);
            }

            try
            {
                if (element != null)
                {
                    switch (element.Command)
                    {
                        case ElementCommand.None:
                            break;
                        case ElementCommand.ShowJournalInNewWindow:
                            MainWindow newWindow = new MainWindow(StartProcess.JOURNAL_PATH);
                            newWindow.Show();
                            break;
                        case ElementCommand.ImportMeetingsAndAppointmentsFromOutlook:
                            DateTime dt = JournalControl.GetDateTime(element.ParentElement.Path);
                            elementControl.AddAppointments(element.ParentElement, dt);
                            //PlanTreeViewItem_Expanded(elementControl.FindElementByGuid(elementControl.Root, element.ParentElement.ID), null);
                            break;
                        case ElementCommand.DisplayMoreAssociations:
                            //Display more association under current command note
                            elementControl.DisplayMoreAssociations(element);
                            break;
                        case ElementCommand.ShowHiddenAssociations:
                            element.ParentElement.ShowAssociationMarkedDone = true;
                            element.ParentElement.ShowAssociationMarkedDefer = true;
                            elementControl.UpdateElement(element.ParentElement);
                            ShowOrHideMarkedAssociation(element.ParentElement, PowerDStatus.Done, true);
                            ShowOrHideMarkedAssociation(element.ParentElement, PowerDStatus.Deferred, true);
                            break;
                    };

                    LogControl.Write(
                        element,
                        LogEventAccess.AssociationContextMenu,
                        LogEventType.CommandNote,
                        LogEventStatus.NULL,
                        null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oops!\nSomething unexpected happened, please close this Planz window and reopen.");
                //MessageBox.Show("AssociationDropDownMenu_Execute\n" + ex.Message);

                LogControl.Write(
                    element,
                    LogEventAccess.AssociationContextMenu,
                    LogEventType.CommandNote,
                    LogEventStatus.Error,
                    LogEventInfo.ErrorMessage + LogControl.COMMA + ex.Message + LogControl.DELIMITER +
                        LogEventInfo.Command + LogControl.COMMA + element.Command.ToString());
            }
        }